PHPackages                             stimlog/stimlog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. stimlog/stimlog

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

stimlog/stimlog
===============

Logging framework for PHP

v0.1.0-alpha(10y ago)0461MITPHPPHP &gt;=5.5.0

Since Jun 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/nicolasherve/StimLog)[ Packagist](https://packagist.org/packages/stimlog/stimlog)[ RSS](/packages/stimlog-stimlog/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

StimLog - Logging framework for PHP
===================================

[](#stimlog---logging-framework-for-php)

StimLog is a logging framework for PHP.

You can easily configure StimLog to change the active log level and thus change the behavior of your loggers without modifying your code.

Its main characteristics are the following:

- Class based
- Trace the class and the line that triggered the log
- Easily configurable to:
- change the active loggers of your application
- change the active log level used in your application
- Easily extendable to add new components (`Writer`s and `Formatter`s)
- A [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) compliant logger is provided

Core concepts
=============

[](#core-concepts)

Every `Logger` instance is dedicated to a class, which makes StimLog a logging framework only for PHP classes.

A `Logger` has a list of `Writer`s (sometimes called *Handlers* or *Appenders*) that will handle the log data. Several `Writer`s are provided, but you are free to provide yours (they will have to extend the `LogWriter` abstract class).

Each `Writer` has one `Formatter`, a component used to process the messages and display it in a particular form. Several `Formatter`s are provided, but you are free to provide yours (they will have to implement the `LogFormatter` interface).

Last but not least, a configuration is required to activate loggers of your code at a specific level, and with specific `Writer`s. This configuration makes it possible to easily change the behavior of your loggers among your application, in a quick way. This congifuration part is freely inspired from the well-known Java logging framework: [log4j](http://logging.apache.org/log4j/)

Usage
=====

[](#usage)

Step 1: Logging in a PHP class
------------------------------

[](#step-1-logging-in-a-php-class)

StimLog loggers have to be created using the `Logger::create()` operation, and giving the client class name as an argument.

Then, the loggers provide operations to log information with different levels.

```
