1. Go to this page and download the library: Download mimmi20/monolog-factory library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mimmi20 / monolog-factory example snippets
return [
'log' => [
'default' => [
'name' => 'name',
'errorLevelMap' => false, // optional: map of php errors to monolog levels, use an empty array if the default map should be used, defaults to false which disables the error handling
'exceptionLevelMap' => false, // optional: map of exceptions to monolog levels, use an empty array if the default map should be used, defaults to false which disables the exception handling
'fatalLevel' => false, // optional: monolog level used to log fatal errors, use null if the default level should be used, defaults to false which disables the handling of fatal errors
'handlers' => [ // Handlers for Monolog
// At the bare minimum you must
return [
'log' => [
'default' => [
'name' => 'name',
'handlers' => [
'default' => [
// A Handler type or pre-configured service from the container
'type' => 'stream',
// Handler specific options. See handlers below
'options' => [
'stream' => '/tmp/log_one.txt',
// Optional: Formatter for the handler.
'formatter' => [
'type' => 'line',
// formatter specific options. See formatters below
'options' => [],
],
// Optional: Processor for the handler
'processors' => [
[
// A processor type or pre-configured service from the container
'type' => 'psrLogMessage',
// processor specific options. See processors below
'options' => [],
],
],
],
],
],
'processors' => [
// Array Keys are the names used for the processors
'processorOne' => [
// A processor type or pre-configured service from the container
'type' => 'psrLogMessage',
// processor specific options. See processors below
'options' => [],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'stream',
'options' => [
'stream' => '/tmp/stream_test.txt', // Required: File Path | Resource | Service Name
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'filePermission' => null, // Optional: file permissions (default (0644) are only for owner read/write)
'useLocking' => false, // Optional: Try to lock log file before doing any writes
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'rotating',
'options' => [
'filename' => '/tmp/stream_test.txt', // Required: File Path
'maxFiles' => 0, // Optional: The maximal amount of files to keep (0 means unlimited)
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'filePermission' => null, // Optional: file permissions (default (0644) are only for owner read/write)
'useLocking' => false, // Optional: Try to lock log file before doing any writes
'filenameFormat' => '{filename}-{date}', // Optional
'dateFormat' => 'Y-m-d', // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'syslog',
'options' => [
'ident' => '/tmp/stream_test.txt', // Required: The string ident is added to each message.
'facility' => LOG_USER, // Optional: The facility argument is used to specify what type of program is logging the message.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'logOpts' => LOG_PID, // Optional: Option flags for the openlog() call, defaults to LOG_PID
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'errorlog',
'options' => [
'messageType' => \Monolog\Handler\ErrorLogHandler::OPERATING_SYSTEM, // Optional: Says where the error should go.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'expandNewlines' => false, // Optional: If set to true, newlines in the message will be expanded to be take multiple log entries
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'process',
'options' => [
'command' => 'some-command', // Command for the process to start. Absolute paths are recommended, especially if you do not use the $cwd parameter.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'cwd' => __DIR__, // Optional: "Current working directory" (CWD) for the process to be executed in.
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'nativeMailer',
'options' => [
'to' => ['[email protected]', '[email protected]'], // The receiver of the mail. Can be an array or string
'subject' => 'Error Log', // The subject of the mail
'from' => '[email protected]', // The sender of the mail
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'maxColumnWidth' => 80, // Optional: The maximum column width that the message lines will have
'contentType' => 'text/html', // Optional
'encoding' => 'utf-8', // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'symfonyMailer',
'options' => [
'mailer' => 'my-service', // The mailer to use. Must be a valid service name in the container
'email-template' => 'my-template', // An email template, the subject/body will be replaced
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'pushover',
'options' => [
'token' => 'sometokenhere', // Pushover api token
'users' => ['[email protected]', '[email protected]'], // Pushover user id or array of ids the message will be sent to
'title' => 'Error Log', // Optional: Title sent to the Pushover API
'level' => \Psr\Log\LogLevel::INFO, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => false, // Optional: Whether the messages that are handled can bubble up the stack or not
'useSSL' => false, // Optional: Whether to connect via SSL. Required when pushing messages to users that are not the pushover.net app owner. OpenSSL is
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'flowdock',
'options' => [
'apiToken' => 'sometokenhere', // HipChat API Token
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'timeout' => 10.0, // Optional
'writeTimeout' => 5.0, // Optional
'persistent' => false, // Optional
'chunkSize' => 100, // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'slackWebhook',
'options' => [
'webhookUrl' => 'webhook.slack.com', // Slack Webhook URL
'channel' => 'channel', // Slack channel (encoded ID or name)
'userName' => 'log', // Name of a bot
'useAttachment' => false, // Optional: Whether the message should be added to Slack as attachment (plain text otherwise)
'iconEmoji' => null, // Optional: The emoji name to use (or null)
'useShortAttachment' => true, // Optional: Whether the the context/extra messages added to Slack as attachments are in a short style
'
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'slack',
'options' => [
'token' => 'apiToken', // Slack API token
'channel' => 'channel', // Slack channel (encoded ID or name)
'userName' => 'log', // Name of a bot
'useAttachment' => false, // Optional: Whether the message should be added to Slack as attachment (plain text otherwise)
'iconEmoji' => null, // Optional: The emoji name to use (or null)
'useShortAttachment' => true, // Optional: Whether the the context/extra messages added to Slack as attachments are in a short style
' ],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'sendgrid',
'options' => [
'apiUser' => 'apiUser', // The SendGrid API User
'apiKey' => 'apiKey', // The SendGrid API Key
'from' => 'from', // The sender of the email
'to' => 'to', // string or array of recipients
'subject' => 'subject', // The subject of the mail
'level' => \Psr\Log\LogLevel::INFO, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => false, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'mandrill',
'options' => [
'apiKey' => 'my-service', // A valid Mandrill API key
'message' => 'my-message', // An example \Swiftmail message for real messages, only the body will be replaced. Must be a valid service name or callable
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'fleepHook',
'options' => [
'token' => 'sometokenhere', // Webhook token
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'timeout' => 10.0, // Optional
'writeTimeout' => 5.0, // Optional
'persistent' => false, // Optional
'chunkSize' => 100, // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'ifttt',
'options' => [
'eventName' => 'eventName', // name of an event
'secretKey' => 'secretKey',
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'telegrambot',
'options' => [
'apiKey' => 'api-key', // Api Key
'channel' => 'channel', // Channel
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'parseMode' => null, // Optional: null or one of 'HTML', 'MarkdownV2', 'Markdown'
'disableWebPagePreview' => null, // Optional: null or boolean
'disableNotification' => null, // Optional: null or boolean
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'socket',
'options' => [
'connectionString' => 'unix:///var/log/httpd_app_log.socket', // Socket connection string. You can use a unix:// prefix to access unix sockets and udp:// to open UDP sockets instead of the default TCP.
'timeout' => 30.0, // Optional: The connection timeout, in seconds.
'writeTimeout' => 90.0, // Optional: Set timeout period on a stream.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'persistent' => false, // Optional
'chunkSize' => 100, // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'amqp',
'options' => [
'exchange' => 'my-service', // AMQPExchange (php AMQP ext) or PHP AMQP lib channel. Must be a valid service.
'exchangeName' => 'log-name', // Optional: Exchange name, for AMQPChannel (PhpAmqpLib) only
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'gelf',
'options' => [
'publisher' => 'my-service', // A Gelf\PublisherInterface object. Must be a valid service.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'zend',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'newRelic',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'appName' => 'my-app', // Optional: Application name
'explodeArrays' => false, // Optional: Explode Arrays
'transactionName' => 'my-transaction', // Optional: Explode Arrays
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'loggly',
'options' => [
'token' => 'sometokenhere', // Webhook token
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'syslogUdp',
'options' => [
'host' => 'somewhere.com', // Host
'port' => 513, // Optional: Port
'facility' => 'Me', // Optional: Facility
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'ident' => 'me-too', // Optional: Program name or tag for each log message.
'rfc' => '', // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'logEntries',
'options' => [
'token' => 'sometokenhere', // Log token supplied by LogEntries
'useSSL' => true, // Optional: Whether or not SSL encryption should be used.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'timeout' => 10.0, // Optional
'writeTimeout' => 5.0, // Optional
'persistent' => false, // Optional
'chunkSize' => 100, // Optional
'host' => 'data.logentries.com', // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'insightops',
'options' => [
'token' => 'sometokenhere', // Log token supplied by InsightOps
'region' => 'region', // Region where InsightOps account is hosted. Could be 'us' or 'eu'.
'useSSL' => true, // Optional: Whether or not SSL encryption should be used.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'timeout' => 10.0, // Optional
'writeTimeout' => 5.0, // Optional
'persistent' => false, // Optional
'chunkSize' => 100, // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'logmatic',
'options' => [
'token' => 'sometokenhere', // Log token supplied by Logmatic.
'hostname' => 'region', // Optional: Host name supplied by Logmatic.
'appname' => 'region', // Optional: Application name supplied by Logmatic.
'useSSL' => true, // Optional: Whether or not SSL encryption should be used.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'timeout' => 10.0, // Optional
'writeTimeout' => 5.0, // Optional
'persistent' => false, // Optional
'chunkSize' => 100, // Optional
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'sqs',
'options' => [
'sqsClient' => 'my-service', // SQS Client. Must be a valid service name in the container.
'queueUrl' => 'url', // URL to SQS Queue
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'firePHP',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'chromePHP',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'browserConsole',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'redis',
'options' => [
'client' => 'my-redis-service-name', // The redis instance. Must be either a [Predis] client OR a Pecl Redis instance
'key' => 'my-service', // The key name to push records to
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'capSize' => true, // Optional: Number of entries to limit list size to, 0 = unlimited
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'redisPubSub',
'options' => [
'client' => 'my-redis-service-name', // The redis instance. Must be either a [Predis] client OR a Pecl Redis instance
'key' => 'my-service', // The key name to push records to
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'mongo',
'options' => [
'client' => 'my-mongo-service-name', // MongoDB library or driver instance.
'database' => 'my-db', // Database name
'collection' => 'collectionName', // Collection name
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'couchDb',
'options' => [
'host' => 'localhost', // Optional: Hostname/Ip address, Default: 'localhost'
'port' => 5984, // Optional: port, Default: 5984
'dbname' => 'db', // Optional: Database Name, Default: 'logger'
'username' => 'someuser', // Optional: Username, Default: null
'password' => 'somepass', // Optional: Password, Default: null
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'doctrineCouchDb',
'options' => [
'client' => 'my-service', // CouchDBClient service name. Must be a valid container service
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'elastica',
'options' => [
'client' => 'my-service', // Elastica Client object. Must be a valid container service
'index' => 'log', // Optional: Elastic index name
'type' => 'record', // Optional: Elastic document type
'ignoreError' => false, // Optional: Suppress Elastica exceptions
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'elasticsearch',
'options' => [
'client' => 'my-service', // Elastica Client object. Must be a valid container service
'index' => 'log', // Optional: Elastic index name
'dateFormat' => \Mimmi20\MonologFactory\Handler\ElasticsearchHandlerFactory::INDEX_PER_DAY, // Optional: possible Values are \Mimmi20\MonologFactory\Handler\ElasticsearchHandlerFactory::INDEX_PER_DAY, \Mimmi20\MonologFactory\Handler\ElasticsearchHandlerFactory::INDEX_PER_MONTH and \Mimmi20\MonologFactory\Handler\ElasticsearchHandlerFactory::INDEX_PER_YEAR
'indexNameFormat' => '{indexname}', // Optional: a string which must contain the string '{indexname}' (which is a placeholder for the `index`) and may contain the string '{date}' (which is a placeholder for the actual date formatted by `dateFormat`)
'type' => 'record', // Optional: Elastic document type
'ignoreError' => false, // Optional: Suppress Elastica exceptions
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'dynamoDb',
'options' => [
'client' => 'my-service', // DynamoDbClient object. Must be a valid container service
'table' => 'log', // Table name
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'fingersCrossed',
'options' => [
'handler' => [], // Required: Registered Handler to wrap
'activationStrategy' => 'my-service', // Optional: Strategy which determines when this handler takes action. Must be either the error level or configured ActivationStrategyInterface service
'bufferSize' => 0, // Optional: How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'stopBuffering' => true, // Optional: Whether the handler should stop buffering after being triggered (default true)
'passthruLevel' => null, // Optional: Minimum level to always flush to handler on close, even if strategy not triggered
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'deduplication',
'options' => [
'handler' => [], // Required: Registered Handler to wrap
'deduplicationStore' => '/tmp/somestore', // Optional: The file/path where the deduplication log should be kept
'deduplicationLevel' => \Psr\Log\LogLevel::ERROR, // Optional:The minimum logging level for log records to be looked at for deduplication purposes
'time' => 60, // Optional: The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'whatFailureGroup',
'options' => [
'handlers' => [], // Required: Array of Handlers to wrap
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'fallbackgroup',
'options' => [
'handlers' => [], // Required: Array of Registered Handlers to wrap
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'buffer',
'options' => [
'handler' => [], // Required: Registered Handler to wrap
'bufferLimit' => 0, // Optional: How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'flushOnOverflow' => true, // Optional: If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'group',
'options' => [
'handlers' => [], // Required: Array of Registered Handlers to wrap
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'filter',
'options' => [
'handler' => [], // Required: Registered Handler to wrap
'minLevelOrList' => \Psr\Log\LogLevel::DEBUG, // Optional: An array of levels to accept or a minimum level if maxLevel is provided
'maxLevel' => \Psr\Log\LogLevel::EMERGENCY, // Optional: Maximum level to accept, only used if $minLevelOrList is not an array
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'null',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'psr',
'options' => [
'logger' => 'loggerService', // Required: Logger Service to wrap from the container
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'test',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'overflow',
'options' => [
'handler' => [], // Required: Registered Handler to wrap
'thresholdMap' => [ // Optional: threshold map
'debug' => 0, // Optional: debug threshold. Default: 0
'info' => 0, // Optional: info threshold. Default: 0
'notice' => 0, // Optional: notice threshold. Default: 0
'warning' => 0, // Optional: warning threshold. Default: 0
'error' => 0, // Optional: error threshold. Default: 0
'critical' => 0, // Optional: critical threshold. Default: 0
'alert' => 0, // Optional: alert threshold. Default: 0
'emergency' => 0, // Optional: emergency threshold. Default: 0
],
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'microsoft-teams',
'options' => [
'url' => '', // Required: Url of the MS Teams Webhook
'title' => '', // Optional: Default Message Title
'subject' => '', // Optional: Message Subject
'emoji' => '', // Optional: custom emoji for the Message (added to the title)
'color' => '', // Optional: custom color for the Message
'format' => '', // Optional: Message format (only used in the default formatter)
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'teams',
'options' => [
'url' => '', // Required: Url of the MS Teams Webhook
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'formatter' => [], // Optional: Formatter for the handler.
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'handlers' => [
'myHandlerName' => [
'type' => 'callbackfilter',
'options' => [
'handler' => [], // Required: Registered Handler to wrap
'filters' => [], // Optional: An array of callback functions
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this handler will be triggered
'bubble' => true, // Optional: Whether the messages that are handled can bubble up the stack or not
'processors' => [], // Optional: Processors for the handler.
],
],
],
],
],
];
return [
'log' => [
'default' => [
'formatters' => [
'myFormatterName' => [
'type' => 'line',
'options' => [
'format' => "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", // Optional
'dateFormat' => "c", // Optional : The format of the timestamp: one supported by DateTime::format
'allowInlineLineBreaks' => false, // Optional : Whether to allow inline line breaks in log entries
'ignoreEmptyContextAndExtra' => false, // Optional
'
return [
'log' => [
'default' => [
'formatters' => [
'myFormatterName' => [
'type' => 'gelf',
'options' => [
'systemName' => "my-system", // Optional : the name of the system for the Gelf log message, defaults to the hostname of the machine
'extraPrefix' => "extra_", // Optional : a prefix for 'extra' fields from the Monolog record
'contextPrefix' => 'ctxt_', // Optional : a prefix for 'context' fields from the Monolog record
'maxLength' => 32766, // Optional : Length per field
'maxNormalizeDepth' => 9, // Optional
'maxNormalizeItemCount' => 1000, // Optional
'prettyPrint' => false, // Optional
],
],
],
],
],
];
return [
'log' => [
'default' => [
'formatters' => [
'myFormatterName' => [
'type' => 'logstash',
'options' => [
'applicationName' => 'app-name', // the application that sends the data, used as the "type" field of logstash
'systemName' => "my-system", // Optional : the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
'extraPrefix' => "extra_", // Optional : prefix for extra keys inside logstash "fields"
'contextPrefix' => 'ctxt_', // Optional : prefix for context keys inside logstash "fields", defaults to ctxt_
'maxNormalizeDepth' => 9, // Optional
'maxNormalizeItemCount' => 1000, // Optional
'prettyPrint' => false, // Optional
],
],
],
],
],
];
return [
'log' => [
'default' => [
'processors' => [
'myProcessorsName' => [
'type' => 'introspection',
'options' => [
'level' => \Psr\Log\LogLevel::DEBUG, // Optional: The minimum logging level at which this processor will be triggered
'skipClassesPartials' => [], // Optional
'skipStackFramesCount' => 0, // Optional
],
],
],
],
],
];
return [
'log' => [
'default' => [
'processors' => [
'myProcessorsName' => [
'type' => 'web',
'options' => [
'serverData' => 'my-service', // Optional: Array, object w/ ArrayAccess, or valid service name that provides access to the $_SERVER data
'extraFields' => [], // Optional: Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer
],
],
],
],
],
];