Logging
[[toc]]
Introduction
In order to understand the running status of the application, Goravel provides a powerful log service that can record log messages and system errors to a file or other channels through facades.Log()
.
Configuration
Make custom configurations in config/logging.go
, allows to configure different log channels.
Goravel
uses stack
channel to record logs by default, stack
allows logs to be forwarded to multiple channels.
The print
configuration in single
and daily
drivers can control log output to console.
Available channel drivers
stack
Allow multiple channels
single
Single log file
daily
One log file per day
custom
Custom drive
Inject Context
Write log messages
Create a custom channel
If you want to define a completely custom channel, you can specify the custom
driver type in the config/logging.go
configuration file. Then include a via
option to implement a framework\contracts\log\Logger
structure:
Implement Driver
Implement framework\contracts\log\Logger
interface.
files can be stored in the app/extensions
folder (modifiable). Example:
Last updated