PHPackages                             mimmi20/monolog-factory - 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. mimmi20/monolog-factory

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

mimmi20/monolog-factory
=======================

Provides a Factory to build a Monolog Logger.

5.0.3(7mo ago)2184.1k↓29.2%1MITPHPPHP ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Jul 13Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/mimmi20/monolog-factory)[ Packagist](https://packagist.org/packages/mimmi20/monolog-factory)[ Docs](https://github.com/mimmi20/monolog-factory)[ RSS](/packages/mimmi20-monolog-factory/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (37)Versions (29)Used By (0)

monolog-factory
===============

[](#monolog-factory)

[Monolog](https://github.com/Seldaek/monolog) Factories for Laminas and Mezzio

This library was inspired by [psr11-monolog](https://gitlab.com/blazon/psr11-monolog)and [monolog-factory](https://github.com/nikolaposa/monolog-factory).

[![Latest Stable Version](https://camo.githubusercontent.com/f65f046fc751730ee0e70b40e9ddf48c9a60f1be8d1af0af9fc732d293b3ee78/68747470733a2f2f706f7365722e707567782e6f72672f6d696d6d6932302f6d6f6e6f6c6f672d666163746f72792f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mimmi20/monolog-factory)[![Latest Unstable Version](https://camo.githubusercontent.com/38e8fb21570883483df2d9f688a78502ae506cb7aaa78ae31c2ea3218df508ac/68747470733a2f2f706f7365722e707567782e6f72672f6d696d6d6932302f6d6f6e6f6c6f672d666163746f72792f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mimmi20/monolog-factory)[![License](https://camo.githubusercontent.com/6b59462d2f94516bfdeae4766e55161edbf77479f817b0b665a360c042811e6f/68747470733a2f2f706f7365722e707567782e6f72672f6d696d6d6932302f6d6f6e6f6c6f672d666163746f72792f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mimmi20/monolog-factory)

Code Status
-----------

[](#code-status)

[![codecov](https://camo.githubusercontent.com/298ca32863d2f3677c8cf5848d1916e032ef2ab3b88f2390eddf369a37206228/68747470733a2f2f636f6465636f762e696f2f67682f6d696d6d6932302f6d6f6e6f6c6f672d666163746f72792f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/mimmi20/monolog-factory)[![Test Coverage](https://camo.githubusercontent.com/7e27e4183db9af583fbb7bf9ce77c62ea68c50f3caa95447346a26a4407f2360/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f66313631636633653261333761316339656237352f746573745f636f766572616765)](https://codeclimate.com/github/mimmi20/monolog-factory/test_coverage)[![Average time to resolve an issue](https://camo.githubusercontent.com/706079e963de64dcc5cc1c7b5da1a22b86e15752590a7b696873a158c9c6e536/68747470733a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f6d696d6d6932302f6d6f6e6f6c6f672d666163746f72792e737667)](https://isitmaintained.com/project/mimmi20/monolog-factory "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/52345647ecf57b7c731f0073622d886977e25a6b2d82a3248fa69a5cb3550563/68747470733a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f6d696d6d6932302f6d6f6e6f6c6f672d666163746f72792e737667)](https://isitmaintained.com/project/mimmi20/monolog-factory "Percentage of issues still open")[![Mutation testing badge](https://camo.githubusercontent.com/e1cd73a53aa160a3bbc065d37c3e8b57dc130a30213c688e0226b805209ba182/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532466d696d6d6932302532466d6f6e6f6c6f672d666163746f72792532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/mimmi20/monolog-factory/master)[![Maintainability](https://camo.githubusercontent.com/12be8c480aee9fec8f807981b64167924d550785e0a272417b68c2f69fdf1744/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f66313631636633653261333761316339656237352f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/mimmi20/monolog-factory/maintainability)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage with Laminas and Mezzio](#usage-with-laminas-and-mezzio)
- [Configuration](#configuration)
    - [Minimal Configuration](#minimal-configuration)
    - [Full Configuration](#full-configuration)
    - [Handlers](#handlers)
        - [Log to files and syslog](#log-to-files-and-syslog)
            - [StreamHandler](#streamhandler)
            - [RotatingFileHandler](#rotatingfilehandler)
            - [SyslogHandler](#sysloghandler)
            - [ErrorLogHandler](#errorloghandler)
            - [ProcessHandler](#processhandler)
        - [Send alerts and emails](#send-alerts-and-emails)
            - [NativeMailerHandler](#nativemailerhandler)
            - [SymfonyMailerHandler](#symfonymailerhandler)
            - [PushoverHandler](#pushoverhandler)
            - [FlowdockHandler](#flowdockhandler)
            - [SlackWebhookHandler](#slackwebhookhandler)
            - [SlackHandler](#slackhandler)
            - [SendGridHandler](#sendgridhandler)
            - [MandrillHandler](#mandrillhandler)
            - [FleepHookHandler](#fleephookhandler)
            - [IFTTTHandler](#ifttthandler)
            - [TelegramBotHandler](#telegrambothandler)
        - [Log specific servers and networked logging](#log-specific-servers-and-networked-logging)
            - [SocketHandler](#sockethandler)
            - [AmqpHandler](#amqphandler)
            - [GelfHandler](#gelfhandler)
            - [ZendMonitorHandler](#zendmonitorhandler)
            - [NewRelicHandler](#newrelichandler)
            - [LogglyHandler](#logglyhandler)
            - [RollbarHandler](#rollbarhandler)
            - [SyslogUdpHandler](#syslogudphandler)
            - [LogEntriesHandler](#logentrieshandler)
            - [InsightOpsHandler](#insightopshandler)
            - [LogmaticHandler](#logmatichandler)
            - [SqsHandler](#sqshandler)
        - [Logging in development](#logging-in-development)
            - [FirePHPHandler](#firephphandler)
            - [ChromePHPHandler](#chromephphandler)
            - [BrowserConsoleHandler](#browserconsolehandler)
        - [Log to databases](#log-to-databases)
            - [RedisHandler](#redishandler)
            - [RedisPubSubHandler](#redispubsubhandler)
            - [MongoDBHandler](#mongodbhandler)
            - [CouchDBHandler](#couchdbhandler)
            - [DoctrineCouchDBHandler](#doctrinecouchdbhandler)
            - [ElasticaHandler](#elasticahandler)
            - [ElasticsearchHandler](#elasticsearchhandler)
            - [DynamoDbHandler](#dynamodbhandler)
        - [Wrappers / Special Handlers](#wrappers--special-handlers)
            - [FingersCrossedHandler](#fingerscrossedhandler)
            - [DeduplicationHandler](#deduplicationhandler)
            - [WhatFailureGroupHandler](#whatfailuregrouphandler)
            - [FallbackGroupHandler](#fallbackgrouphandler)
            - [BufferHandler](#bufferhandler)
            - [GroupHandler](#grouphandler)
            - [FilterHandler](#filterhandler)
            - [SamplingHandler](#samplinghandler)
            - [NoopHandler](#noophandler)
            - [NullHandler](#nullhandler)
            - [PsrHandler](#psrhandler)
            - [TestHandler](#testhandler)
            - [OverflowHandler](#overflowhandler)
        - [3rd Party Handlers](#3rd-party-handlers)
            - [MicrosoftTeamsHandler](#microsoftteamshandler)
            - [TeamsLogHandler](#teamsloghandler)
            - [CallbackFilterHandler](#callbackfilterhandler)
    - [Formatters](#formatters)
        - [LineFomatter](#linefomatter)
        - [HtmlFormatter](#htmlformatter)
        - [NormalizerFormatter](#normalizerformatter)
        - [ScalarFormatter](#scalarformatter)
        - [JsonFormatter](#jsonformatter)
        - [WildfireFormatter](#wildfireformatter)
        - [ChromePHPFormatter](#chromephpformatter)
        - [GelfMessageFormatter](#gelfmessageformatter)
        - [LogstashFormatter](#logstashformatter)
        - [ElasticaFormatter](#elasticaformatter)
        - [ElasticsearchFormatter](#elasticsearchformatter)
        - [LogglyFormatter](#logglyformatter)
        - [FlowdockFormatter](#flowdockformatter)
        - [MongoDBFormatter](#mongodbformatter)
        - [LogmaticFormatter](#logmaticformatter)
        - [FluentdFormatter](#fluentdformatter)
        - [StreamFormatter](#streamformatter)
    - [Processors](#processors)
        - [PsrLogMessageProcessor](#psrlogmessageprocessor)
        - [IntrospectionProcessor](#introspectionprocessor)
        - [WebProcessor](#webprocessor)
        - [MemoryUsageProcessor](#memoryusageprocessor)
        - [MemoryPeakUsageProcessor](#memorypeakusageprocessor)
        - [ProcessIdProcessor](#processidprocessor)
        - [UidProcessor](#uidprocessor)
        - [GitProcessor](#gitprocessor)
        - [MercurialProcessor](#mercurialprocessor)
        - [TagProcessor](#tagprocessor)
        - [HostnameProcessor](#hostnameprocessor)

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

[](#installation)

Run

```
composer require mimmi20/monolog-factory
```

Usage with Laminas and Mezzio
-----------------------------

[](#usage-with-laminas-and-mezzio)

You'll need to add configuration and register the services you'd like to use. There are number of ways to do that but the recommended way is to create a new config file `config/autoload/logger.config.php`

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

[](#configuration)

config/autoload/logger.config.php

```
