Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
Revert "Remove ThreadedLogger, convert AttachableThreadedLogger to tr…
Browse files Browse the repository at this point in the history
…ait"

This reverts commit 9138a04.
  • Loading branch information
dktapps committed Nov 1, 2021
1 parent 2894d03 commit 61f709e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 70 deletions.
44 changes: 39 additions & 5 deletions src/AttachableThreadedLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,50 @@
* GNU General Public License for more details.
*/

interface AttachableThreadedLogger extends \Logger{
abstract class AttachableThreadedLogger extends \ThreadedLogger{

public function addAttachment(\ThreadedLoggerAttachment $attachment) : void;
/** @var \Volatile|\ThreadedLoggerAttachment[] */
protected $attachments;

public function removeAttachment(\ThreadedLoggerAttachment $attachment) : void;
public function __construct(){
$this->attachments = new \Volatile();
}

public function removeAttachments() : void;
/**
* @param ThreadedLoggerAttachment $attachment
*
* @return void
*/
public function addAttachment(\ThreadedLoggerAttachment $attachment){
$this->attachments[] = $attachment;
}

/**
* @param ThreadedLoggerAttachment $attachment
*
* @return void
*/
public function removeAttachment(\ThreadedLoggerAttachment $attachment){
foreach($this->attachments as $i => $a){
if($attachment === $a){
unset($this->attachments[$i]);
}
}
}

/**
* @return void
*/
public function removeAttachments(){
foreach($this->attachments as $i => $a){
unset($this->attachments[$i]);
}
}

/**
* @return \ThreadedLoggerAttachment[]
*/
public function getAttachments() : array;
public function getAttachments(){
return (array) $this->attachments;
}
}
65 changes: 0 additions & 65 deletions src/AttachableThreadedLoggerTrait.php

This file was deleted.

20 changes: 20 additions & 0 deletions src/ThreadedLogger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/*
* PocketMine Standard PHP Library
* Copyright (C) 2014-2018 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

abstract class ThreadedLogger extends \Threaded implements Logger{

}

0 comments on commit 61f709e

Please sign in to comment.