Skip to content

presprog/kirby-monolog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📜 Monolog for Kirby CMS

This plugin adds the Monolog logging library to Kirby.

⚡ Ready for Kirby 4!

🤟Usage

Use the monolog() helper function:

// Write to the default log file
monolog()->log('something happend 😱');

// Log to another channel (only changes the filename for now)
// Will log to "your-log-dir/other-channel-$date.log"
monolog('other-channel')->log('something happend 😱');

// Change the log level (any of \Psr\Log\LogLevel)
monolog()->log('something CRITICAL happend 😱', 'critical');

// …

If you throw and handle exceptions in your own code, you may log them with site()->logException():

try {
    // ..
} catch(\Exception $exception) {
    site()->logException($exception)
}

This will log the exception message with critical level alongside the stack trace.

The plugin also automatically listens to Kirby system.exception hook and logs the exception message as well as the stacktrace to the default log file.

💻 How to install

via Composer (recommended)

$ composer require presprog/kirby-monolog:^0.1

via ZIP archive

Download the ZIP archive, extract it into your plugins folder (defaults to site/plugins) and rename the subfolder to monolog.

✅ To do

  • Define more channels via the config file

Alternatives

There are plenty of alternatives:


Made with ♥️ and ☕ by Present Progressive

About

This plugin integrates the Monolog logging library with Kirby CMS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages