PHPackages                             swestcott/monolog-extension - 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. swestcott/monolog-extension

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

swestcott/monolog-extension
===========================

Monolog extension for Behat

24582PHP

Since Jul 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/swestcott/MonologExtension)[ Packagist](https://packagist.org/packages/swestcott/monolog-extension)[ RSS](/packages/swestcott-monolog-extension/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

MonologExtension
================

[](#monologextension)

- [master](https://github.com/swestcott/MonologExtension) [![Build Status](https://camo.githubusercontent.com/6f74d0e30f5810b53be5cceb106cb498797f0c5ea0a97996749ed10380e06e29/68747470733a2f2f7472617669732d63692e6f72672f7377657374636f74742f4d6f6e6f6c6f67457874656e73696f6e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/swestcott/MonologExtension) [![Coverage Status](https://camo.githubusercontent.com/f7e2bece931f9e9532aed684a18af5b7a4aa69c08efc248db7b8e0b59ebfdb8b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7377657374636f74742f4d6f6e6f6c6f67457874656e73696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/swestcott/MonologExtension?branch=master)
- [develop](https://github.com/swestcott/MonologExtension/tree/develop) [![Build Status](https://camo.githubusercontent.com/91900a73555ae2b0cee50534ceca21c09d06a275d63b86bd92281db82a3c0fd0/68747470733a2f2f7472617669732d63692e6f72672f7377657374636f74742f4d6f6e6f6c6f67457874656e73696f6e2e706e673f6272616e63683d646576656c6f70)](https://travis-ci.org/swestcott/MonologExtension) [![Coverage Status](https://camo.githubusercontent.com/78b785825bdfa26d000df7a11eaf9a25ebf411ddbd500fd057855df2c76b0bcb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7377657374636f74742f4d6f6e6f6c6f67457874656e73696f6e2f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/r/swestcott/MonologExtension?branch=develop)

Integrates the [Monolog](https://github.com/Seldaek/monolog) logging framework with Behat.

Installation
------------

[](#installation)

Add the dependency to composer.json,

```
"require": {
    ...
    "swestcott/monolog-extension": "*"
}
```

And install/update your dependancies,

```
$ curl http://getcomposer.org/installer | php
$ php composer.phar install
```

Configuration
-------------

[](#configuration)

```
# behat.yml
default:
  extensions:
    swestcott\MonologExtension\Extension:
      handlers:
        stdout:
          type: stream
          path: php://stdout
          level: debug
```

Usage
-----

[](#usage)

Each context/subcontext is assigned it's own Monolog channel, named after context class name. It is set directly against the context.

### Example 1

[](#example-1)

```
class FeatureContext extends BehatContext
{
    /**
     * @When /^I add together "([^"]*)" and "([^"]*)"$/
     */
    public function iAddTogether($value1, $value2)
    {
        $this->logger->info('Adding "' . $value1 . '" and "' . $value2 . '"');
        $this->result = $value1 + $value2;
    }
}
```

Output,

```
[2013-01-01 00:00:00] FeatureContext.INFO: Adding "1" and "2" [] []

```

### Example 2

[](#example-2)

Including context in messages

```
class FeatureContext extends BehatContext
{
    /**
     * @When /^I add together "([^"]*)" and "([^"]*)"$/
     */
    public function iAddTogether($value1, $value2)
    {
        $this->logger->info('Adding values', array($value1, $value2));
        $this->result = $value1 + $value2;
    }
}
```

Output,

```
[2013-01-01 00:00:00] FeatureContext.INFO: Adding values ["1", "2"] []

```

Copyright
---------

[](#copyright)

Copyright (c) 2013 Simon Westcott. See LICENSE for details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.5% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff9e1035ca2520501248c3141ba5536e9ac454be7d271c1fd20c43e607449389?d=identicon)[swestcott](/maintainers/swestcott)

---

Top Contributors

[![swestcott](https://avatars.githubusercontent.com/u/58629?v=4)](https://github.com/swestcott "swestcott (52 commits)")[![jakzal](https://avatars.githubusercontent.com/u/190447?v=4)](https://github.com/jakzal "jakzal (3 commits)")

### Embed Badge

![Health badge](/badges/swestcott-monolog-extension/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)

PHPackages © 2026

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