LogManager
class LogManager implements LoggerInterface mixin Logger (View source)
Traits
Properties
protected array | $levels | The Log levels. |
from ParsesLogConfiguration |
protected Application | $app | The application instance. |
|
protected array | $channels | The array of resolved channels. |
|
protected array | $sharedContext | The context shared across channels and stacks. |
|
protected array | $customCreators | The registered custom driver creators. |
|
protected string | $dateFormat | The standard date format to use when writing logs. |
Methods
Get fallback log channel name.
Parse the string level into a Monolog constant.
Parse the action level from the given configuration.
Extract the log channel from the given configuration.
Build an on-demand log channel.
Create a new, on-demand aggregate logger instance.
Get a log channel instance.
Get a log driver instance.
Attempt to get the log from the local cache.
Parse the given tap class string into a class name and arguments string.
Create an emergency log handler to avoid white screens of death.
Resolve the given log instance by name.
Call a custom driver creator.
Create a custom log driver instance.
Create an aggregate log driver instance.
Create an instance of the single file log driver.
Create an instance of the daily file log driver.
Create an instance of the Slack log driver.
Create an instance of the syslog log driver.
Create an instance of the "error log" log driver.
Create an instance of any handler available in Monolog.
Prepare the handlers for usage by Monolog.
Prepare the handler for usage by Monolog.
Get a Monolog formatter instance.
Share context across channels and stacks.
The context shared across channels and stacks.
Flush the shared context.
Get the log connection configuration.
Get the default log driver name.
Set the default log driver name.
Unset the given channel instance.
Parse the driver name.
Get all of the resolved log channels.
System is unusable.
Action must be taken immediately.
Critical conditions.
Runtime errors that do not require immediate action but should typically be logged and monitored.
Exceptional occurrences that are not errors.
Normal but significant events.
Interesting events.
Detailed debug information.
Logs with an arbitrary level.
Dynamically call the default driver instance.
Details
protected string
getFallbackChannelName()
Get fallback log channel name.
protected int
level(array $config)
Parse the string level into a Monolog constant.
protected int
actionLevel(array $config)
Parse the action level from the given configuration.
protected string
parseChannel(array $config)
Extract the log channel from the given configuration.
void
__construct(Application $app)
Create a new Log manager instance.
LoggerInterface
build(array $config)
Build an on-demand log channel.
LoggerInterface
stack(array $channels, string|null $channel = null)
Create a new, on-demand aggregate logger instance.
LoggerInterface
channel(string|null $channel = null)
Get a log channel instance.
LoggerInterface
driver(string|null $driver = null)
Get a log driver instance.
protected LoggerInterface
get(string $name, array|null $config = null)
Attempt to get the log from the local cache.
protected array
parseTap(string $tap)
Parse the given tap class string into a class name and arguments string.
protected LoggerInterface
createEmergencyLogger()
Create an emergency log handler to avoid white screens of death.
protected LoggerInterface
resolve(string $name, array|null $config = null)
Resolve the given log instance by name.
protected mixed
callCustomCreator(array $config)
Call a custom driver creator.
protected LoggerInterface
createCustomDriver(array $config)
Create a custom log driver instance.
protected LoggerInterface
createStackDriver(array $config)
Create an aggregate log driver instance.
protected LoggerInterface
createSingleDriver(array $config)
Create an instance of the single file log driver.
protected LoggerInterface
createDailyDriver(array $config)
Create an instance of the daily file log driver.
protected LoggerInterface
createSlackDriver(array $config)
Create an instance of the Slack log driver.
protected LoggerInterface
createSyslogDriver(array $config)
Create an instance of the syslog log driver.
protected LoggerInterface
createErrorlogDriver(array $config)
Create an instance of the "error log" log driver.
protected LoggerInterface
createMonologDriver(array $config)
Create an instance of any handler available in Monolog.
protected array
prepareHandlers(array $handlers)
Prepare the handlers for usage by Monolog.
protected HandlerInterface
prepareHandler(HandlerInterface $handler, array $config = [])
Prepare the handler for usage by Monolog.
protected FormatterInterface
formatter()
Get a Monolog formatter instance.
$this
shareContext(array $context)
Share context across channels and stacks.
array
sharedContext()
The context shared across channels and stacks.
$this
flushSharedContext()
Flush the shared context.
protected array
configurationFor(string $name)
Get the log connection configuration.
string|null
getDefaultDriver()
Get the default log driver name.
void
setDefaultDriver(string $name)
Set the default log driver name.
$this
extend(string $driver, Closure $callback)
Register a custom driver creator Closure.
void
forgetChannel(string|null $driver = null)
Unset the given channel instance.
protected string|null
parseDriver(string|null $driver)
Parse the driver name.
array
getChannels()
Get all of the resolved log channels.
void
emergency(string $message, array $context = [])
System is unusable.
void
alert(string $message, array $context = [])
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
void
critical(string $message, array $context = [])
Critical conditions.
Example: Application component unavailable, unexpected exception.
void
error(string $message, array $context = [])
Runtime errors that do not require immediate action but should typically be logged and monitored.
void
warning(string $message, array $context = [])
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
void
notice(string $message, array $context = [])
Normal but significant events.
void
info(string $message, array $context = [])
Interesting events.
Example: User logs in, SQL logs.
void
debug(string $message, array $context = [])
Detailed debug information.
void
log(mixed $level, string $message, array $context = [])
Logs with an arbitrary level.
mixed
__call(string $method, array $parameters)
Dynamically call the default driver instance.