PHP Class Autarky\Logging\ChannelManager

Inheritance: extends Psr\Log\AbstractLogger, implements Psr\Log\LoggerInterface
Show file Open project: autarky/framework Class Usage Examples

Protected Properties

Property Type Description
$channels Psr\Log\LoggerInterface[] The defined channels.
$defaultChannel string The name of the default channel to use.
$deferredChannels callable[] The deferred channel callbacks.

Public Methods

Method Description
__construct ( string $defaultChannel = 'default' ) Constructor.
getChannel ( string $channel = null ) : Psr\Log\LoggerInterface Get a specific channel.
getDefaultChannelName ( ) : string Get the name of the default channel.
log ( $level, $message, array $context = [] )
setChannel ( string $channel, Psr\Log\LoggerInterface $logger ) Set a channel instance.
setDefaultChannel ( string $channel ) Change the default channel.
setDeferredChannel ( string $channel, callable $callback ) Define a deferred channel. The callback will be invoked and the return value passed to setChannel. The return value must implement Psr\Log\LoggerInterface.

Method Details

__construct() public method

Constructor.
public __construct ( string $defaultChannel = 'default' )
$defaultChannel string

getChannel() public method

Get a specific channel.
public getChannel ( string $channel = null ) : Psr\Log\LoggerInterface
$channel string Optional - if none, use default channel
return Psr\Log\LoggerInterface

getDefaultChannelName() public method

Get the name of the default channel.
public getDefaultChannelName ( ) : string
return string

log() public method

public log ( $level, $message, array $context = [] )
$context array

setChannel() public method

Set a channel instance.
public setChannel ( string $channel, Psr\Log\LoggerInterface $logger )
$channel string
$logger Psr\Log\LoggerInterface

setDefaultChannel() public method

Change the default channel.
public setDefaultChannel ( string $channel )
$channel string

setDeferredChannel() public method

Define a deferred channel. The callback will be invoked and the return value passed to setChannel. The return value must implement Psr\Log\LoggerInterface.
public setDeferredChannel ( string $channel, callable $callback )
$channel string
$callback callable Callback that takes no arguments

Property Details

$channels protected property

The defined channels.
protected LoggerInterface[],Psr\Log $channels
return Psr\Log\LoggerInterface[]

$defaultChannel protected property

The name of the default channel to use.
protected string $defaultChannel
return string

$deferredChannels protected property

The deferred channel callbacks.
protected callable[] $deferredChannels
return callable[]