PHPackages                             epilog/epilog - 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. epilog/epilog

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

epilog/epilog
=============

Very useful logger for php 5.4+

1.2(10y ago)454[2 issues](https://github.com/alexeytihomirov/Epilog/issues)MITPHPPHP &gt;=5.4.0

Since Apr 15Pushed 7y ago3 watchersCompare

[ Source](https://github.com/alexeytihomirov/Epilog)[ Packagist](https://packagist.org/packages/epilog/epilog)[ Docs](http://github.com/alexeytihomirov/Epilog/)[ RSS](/packages/epilog-epilog/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (1)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/f6fda2704d29ac90e23a93662a10b2083076c8e55f4a7af4a58f63ffc5caef87/68747470733a2f2f706f7365722e707567782e6f72672f6570696c6f672f6570696c6f672f762f737461626c65)](https://packagist.org/packages/epilog/epilog) [![Total Downloads](https://camo.githubusercontent.com/fc6c69790781826a973ec8b2fe95efe0b9dcf04c52621f8ec84ef4de6293dc2e/68747470733a2f2f706f7365722e707567782e6f72672f6570696c6f672f6570696c6f672f646f776e6c6f616473)](https://packagist.org/packages/epilog/epilog) [![Latest Unstable Version](https://camo.githubusercontent.com/ee48409cf0b7ce4c7277635ff9c76e85703a3269be129e2ca19796c7b948065a/68747470733a2f2f706f7365722e707567782e6f72672f6570696c6f672f6570696c6f672f762f756e737461626c65)](https://packagist.org/packages/epilog/epilog) [![License](https://camo.githubusercontent.com/62d0e3496a82259ae0117b9005438cb0f8b9b164cc9fecce9fcf33db3a966fa4/68747470733a2f2f706f7365722e707567782e6f72672f6570696c6f672f6570696c6f672f6c6963656e7365)](https://packagist.org/packages/epilog/epilog)

[![SensioLabsInsight](https://camo.githubusercontent.com/3f168732166ab98ce2c0351ff5d1670d3da5a077def3a792fe24443cbe0b5b92/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66653261313531662d616337322d343733352d396636392d6464393936656335636434352f6269672e706e67)](https://insight.sensiolabs.com/projects/fe2a151f-ac72-4735-9f69-dd996ec5cd45)

Epilog - Logger for PHP 5.4+
============================

[](#epilog---logger-for-php-54)

This is simple to use logger with great syntax and level of customization. Easy start for new application and serious tune for grown application. Look at examples and feature list below. Enjoy!

Usage
-----

[](#usage)

```
include "Epilog.php";

$log = new Epilog();
$log('By default php://stdout is output stream and info is selected severity');
```

Will output

```
[2014-01-20 11:36:36.43] Info: By default php://stdout is output stream and info is selected severity

```

Install
-------

[](#install)

Just add epilog/epilog to require section in composer.json and install it. For example:

```
    "require": {
        "epilog/epilog": "1.1.0"
    }

```

Main goal
---------

[](#main-goal)

Epilog was made as tool for developers by developers. You can make hot start and then change everything by accessing public properties of object. Main goal is to make debug as simple as we can! Many years of debug expirience are here in Epilog. What about other loggers? They are too big and uncomfortable. With Epilog you can end your application while your friend is setting up another logger.

Advanced features
-----------------

[](#advanced-features)

- PSR-3 support
- Different severity levels
- Add your own severity levels
- Select strict severity level (handle only selected level)
- Timers
- Handle strict severity levels by different channels
- Custom handlers
- Different channels support
- Context support
- Setup custom formatter
- Setup custom filter set
- Possibility to log raw data
- Turn off logger
- Buffer with custom size
- Date format change

PSR-3 support
-------------

[](#psr-3-support)

Epilog is [PSR-3 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) compatible. Use Pepilog class that implemets Psr\\Log\\LoggerInterface. All psr-3 tests are passed perfectly. You can use Pepilog with Silex, Symfony2 and others.

Silex example:

```
require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application();

$app['logger'] = $app->share(function(){
	return new Pepilog('/tmp/temp.log', 'debug');
});
```

Different severity levels
-------------------------

[](#different-severity-levels)

Supports 8 standard severity levels. You can easly add your own.

**debug** - debug-level messages
**info** - informational messages **notice** - normal but significant condition **warning** - warning conditions **error** - error conditions **critical** - critical conditions **alert** - action must be taken immediately **emergency** - system is unusable

How to write to different levels?

```
$log['debug']("Application start.");
$log['error']("Application error.");
$log['alert']("Can't write to cache. Access denied");
```

How to select output level? Just specify it as second parameter

```
$log = new Epilog('php://stdout', "error");
```

How to add severity levels?

```
$log->levels['customLevel'] = 450;
$log['customLevel']("Custom severity level log");
```

What is "strict severity level"? In this case only errors will be handled by logger.

```
$log = new Epilog('php://stdout', "=error");
```

Timers
------

[](#timers)

You can setup and use different timers in your application

```
$log->timerStart('timer1');
$log['info']("Aplication start");

sleep(1);

$log['info:timer1']("Application end");
$log[':timer1']("Write to default level with timer value");
```

Will output

```
[2014-01-21 11:30:45.22] Info: Aplication start
[2014-01-21 11:30:46.22] 1.0007s Info: Application end
[2014-01-21 11:30:46.22] 1.0010s Info: Write to default level with timer value

```

You can reset timer

```
$log->timerReset('timer1');
```

Or stop it

```
$log->timerStop('timer1');
```

Custom handlers
---------------

[](#custom-handlers)

You can add your custom handler to channel. For example MySQL handler:

```
$customHandler = function($logString, $params) use ($config) {
  static $connection = null;
  if (!$connection) {
      $connection = new PDO('mysql:host=localhost;dbname=test', $config['dbuser'], $config['dbpass']);
  }

  $stmt = $dbh->prepare(
    "INSERT INTO log_table(date, timer, level, context, text, formatted_text)
    VALUES (:date, :timer, :level, :context, :text, :formatted_text)"
  );
  $stmt->bindParam(':date', $params['date']);
  $stmt->bindParam(':timer', $params['timer']);
  $stmt->bindParam(':level', $params['level']);
  $stmt->bindParam(':context', $params['context'];
  $stmt->bindParam(':text', $params['text']);
  $stmt->bindParam(':formatted_text', $logString);
  $stmt->execute();
}
$log = new Epilog($customHandler);
```

Different channels support with different level
-----------------------------------------------

[](#different-channels-support-with-different-level)

There is simple way to setup different channels. You can use severity standard and strict notation.

```
$channels = [
  'info'  => ["php://stdout", function($logString, $params){file_put_contents('filename', $text);}],
  'error' => ["php://stderr", "/var/log/application_error.log"], // These handlers will process error+ levels
  '=debug' => ["/tmp/application_debug.log"]  // These handlers will process only debug level
];
$log = new Epilog($channels);
```

Context support
---------------

[](#context-support)

You can use global and local context. It accepts only arrays of data.

```
$log->context = ['user_name'=>'Bob']; // Setting up global context
$log("User {user_name}({user_id}) is logged in", ['user_id'=>33]); // Adding local context
$log("User {user_name}({user_id}) is logged out"); // Without local context
```

Will output

```
[2014-01-21 11:17:45.56] info: User Bob(33) is logged in {"user_name":"Bob","user_id":33}
[2014-01-21 11:17:45.56] info: User Bob({user_id}) is logged out {"user_name":"Bob"}

```

Setup custom formatter
----------------------

[](#setup-custom-formatter)

You can use $get helper function that can prepend and append symbols to parameter if it isn't empty.

```
$get('date', '[', ']'); // Will return [2014-01-21 11:17:45] if not empty (depends on format)
$params['date']; // Contains date value
```

Example:

```
$customFormatter = function($params, $get){
    return "{$get('date')}{$get('timer', ' (', 's)')} !{$get('level')}!: {$get('text')} \n";
};
$log = new Epilog('php://stdout', 'info', $customFormatter);

$log['timer'] = 'start';
$log("Message without timer");
$log[':timer']("Message with timer");
```

Will return

```
2014-01-21 11:31:37 !Info!: Message without timer
2014-01-21 11:31:37 (0.0003s) !Info!: Message with timer

```

Setup custom filters set
------------------------

[](#setup-custom-filters-set)

You can add more filters or remove default(filter milliseconds and timer format)

```
unset($log->filter['default']);  // Remove default filters

$log->filter[] = function($params){
  $params['text'] = trim($params['text']); // Text trim filter
  return $params;
};
```

Available params:

- date
- ms
- timer
- level
- context
- text Log raw data

---

Just concatenate Epilog::RAW or add null byte before log string:

```
$log(Epilog::RAW."Raw log string\n");
$log("\0Raw log string 2\n");
```

```
Raw log string
Raw log string 2

```

Turn on/off logger
------------------

[](#turn-onoff-logger)

Simply setup log level to "off" or use Epilog::TURN\_OFF constant

```
$log = new Epilog();
$log->turnOff();

echo $log->status(); // off
$log->turnOn();
echo $log->status(); // on
```

Buffer with custom size
-----------------------

[](#buffer-with-custom-size)

By default size is 0 (unlimited)

```
$log = new Epilog("logger://buffer"); // You can use Epilog::BUFFER_ADDRESS constant instead of "logger://buffer"
$log->bufferSize = 2; // Store 2 last messages
$log("Foo");
$log("Bar");
$log("Baz");

echo $log; // __toString() will output buffer
```

```
[2014-01-21 11:55:49.80] Info: Bar
[2014-01-21 11:55:49.80] Info: Baz

```

Change date format
------------------

[](#change-date-format)

```
$log->dateFormat = "d.m.Y H:i:s"; // By default is "Y-m-d H:i:s"
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~144 days

Total

4

Last Release

3981d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e4d9e3b42ee7ce863792f404e924b1706e8061d1a39f6cdae5c1bb481b74760?d=identicon)[alexeytihomirov](/maintainers/alexeytihomirov)

---

Top Contributors

[![alexeytihomirov](https://avatars.githubusercontent.com/u/2974918?v=4)](https://github.com/alexeytihomirov "alexeytihomirov (14 commits)")

---

Tags

loglogger

### Embed Badge

![Health badge](/badges/epilog-epilog/health.svg)

```
[![Health](https://phpackages.com/badges/epilog-epilog/health.svg)](https://phpackages.com/packages/epilog-epilog)
```

###  Alternatives

[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[amphp/log

Non-blocking logging for PHP based on Amp, Revolt, and Monolog.

402.6M70](/packages/amphp-log)[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

511.0M18](/packages/apix-log)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)[wa72/simplelogger

Wa72SimpleLogger is a collection of very simple loggers implementing \\Psr\\Log\\LoggerInterface (PSR-3)

13246.6k13](/packages/wa72-simplelogger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
