Download the PHP package morningtrain/wp-logger without Composer
On this page you can find all versions of the php package morningtrain/wp-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wp-logger
WP Logger
Make it easier to handle different levels of log.
Table of Contents
- Introduction
- Getting Started
- Installation
- Dependencies
- Usage
- Initializing package
- Use package
- Contributing
- Contributors
- License
Introduction
Make it easier to handle different levels of log.
Getting Started
To get started install the package as described below in Installation.
To use the tool have a look at Usage
Installation
Install with composer
Dependencies
Usage
Initializing package
First of all, to get \Morningtrain\WP\Logger\Loggers\DatabaseLogger
to work, the migration needs to be run. This is done be running the following method:
Initialize \Morningtrain\WP\Logger\Logger
with a slug and an array of the loggers that needs to be registered.
For each logger, there is some levels, that can be registered for the specific logger.
Loggers
Each logger has the following methods, to register what level(s) that is needed:
->registerLevel($level)
->registerLevels([$level])
->registerAllLevels()
Database Logger
Make it possible to save logs to the database.
Class: \Morningtrain\WP\Logger\Loggers\DatabaseLogger
File Logger
Make it possible to save logs to a file.
Class: \Morningtrain\WP\Logger\Loggers\FileLogger
Parameters in callback:
string $filename
Mail Logger
Make it possible to send logs to multiple emails.
Class: \Morningtrain\WP\Logger\Loggers\MailLogger
Parameters in callback:
array $emails
Ray Logger
Make it possible to send logs to a Ray client.
Class: \Morningtrain\WP\Logger\Loggers\RayLogger
Parameters in callback:
bool $backtrace // Optional. If true, it will add backtrace
Levels
Use package
To get the Logger, that has been registered, the method \Morningtrain\WP\Logger\Logger::getLogger($slug)
, where the slug is needed.
When the logger is collected, there is a method, for each level, that can be call:
Each of these methods that:
string $message
array $context // Optional
Contributing
Thank you for your interest in contributing to the project.
Bug Report
If you found a bug, we encourage you to make a pull request.
To add a bug report, create a new issue. Please remember to add a telling title, detailed description and how to reproduce the problem.
Support Questions
We do not provide support for this package.
Pull Requests
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
Contributors
- Martin Schadegg Brønniche
- Mathias Bærentsen
- All Contributors
License
The MIT License (MIT). Please see License File for more information.