{"id":18656263,"url":"https://github.com/bayfrontmedia/multi-logger","last_synced_at":"2026-02-06T23:34:24.992Z","repository":{"id":187795838,"uuid":"677588171","full_name":"bayfrontmedia/multi-logger","owner":"bayfrontmedia","description":"An easy-to-use library used to manage multiple Monolog channels from a single class.","archived":false,"fork":false,"pushed_at":"2024-12-25T10:48:20.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-08T07:59:45.429Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bayfrontmedia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-12T01:36:42.000Z","updated_at":"2024-12-25T10:48:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"c85aad2e-3764-408e-a9ba-c5db051fa219","html_url":"https://github.com/bayfrontmedia/multi-logger","commit_stats":null,"previous_names":["bayfrontmedia/multi-logger"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bayfrontmedia/multi-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Fmulti-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Fmulti-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Fmulti-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Fmulti-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bayfrontmedia","download_url":"https://codeload.github.com/bayfrontmedia/multi-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bayfrontmedia%2Fmulti-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29180487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T23:15:33.022Z","status":"ssl_error","status_checked_at":"2026-02-06T23:15:09.128Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T07:22:41.726Z","updated_at":"2026-02-06T23:34:24.971Z","avatar_url":"https://github.com/bayfrontmedia.png","language":"PHP","readme":"## Multi-Logger\n\nAn easy-to-use library used to manage multiple [Monolog](https://github.com/Seldaek/monolog) channels from a single class.\n\n- [License](#license)\n- [Author](#author)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## Author\n\n\u003cimg src=\"https://cdn1.onbayfront.com/bfm/brand/bfm-logo.svg\" alt=\"Bayfront Media\" width=\"250\" /\u003e\n\n- [Bayfront Media homepage](https://www.bayfrontmedia.com?utm_source=github\u0026amp;utm_medium=direct)\n- [Bayfront Media GitHub](https://github.com/bayfrontmedia)\n\n## Requirements\n\n* PHP `^8.0` (Tested up to `8.4`)\n\n## Installation\n\n```\ncomposer require bayfrontmedia/multi-logger\n```\n\n## Usage\n\n**NOTE:** All exceptions thrown by Multi-Logger extend `Bayfront\\MultiLogger\\Exceptions\\MultiLoggerException`, so you can choose to catch exceptions as narrowly or broadly as you like. \n\nMulti-Logger exists in order manage multiple Monolog channels from a single class.\n\nIn some cases, you may still need to interact with the `Monolog\\Logger` object directly, and Multi-Logger allows you to do that via the [getChannel](#getchannel) method.\n\nA `Logger` instance must be passed to the constructor, and will automatically be set as the default and current channel.\n\nTo aid in consistency when referencing log channels, the `Bayfront\\MultiLogger\\ChannelName` class contains constants with suggested channel names, including:\n\n- `APP`\n- `AUDIT`\n- `CLI`\n- `DATABASE`\n- `CONTROLLER`\n- `DEV`\n- `ERROR`\n- `HEALTH`\n- `HTTP`\n- `JOB`\n- `MODEL`\n- `NOTIFICATION`\n- `OPS`\n- `PRIVILEGES`\n- `PROD`\n- `QA`\n- `QUEUE`\n- `REQUEST`\n- `RESPONSE`\n- `ROUTER`\n- `SCHEDULE`\n- `SECURITY`\n- `STAGING`\n- `STORAGE`\n\n**Example:**\n\n```php\nuse Bayfront\\MultiLogger\\ChannelName;\nuse Bayfront\\MultiLogger\\Log;\nuse Monolog\\Logger;\nuse Monolog\\Handler\\FirePHPHandler;\n\n$app_channel = new Logger(ChannelName::APP);\n$app_channel-\u003epushHandler(new FirePHPHandler());\n\n$log = new Log($app_channel);\n```\n\n### Public methods\n\n- [getChannels](#getchannels)\n- [getDefaultChannel](#getdefaultchannel)\n- [getCurrentChannel](#getcurrentchannel)\n- [addChannel](#addchannel)\n- [isChannel](#ischannel)\n- [getChannel](#getchannel)\n- [channel](#channel)\n\n**Logging events**\n\n- [emergency](#emergency)\n- [alert](#alert)\n- [critical](#critical)\n- [error](#error)\n- [warning](#warning)\n- [notice](#notice)\n- [info](#info)\n- [debug](#debug)\n- [log](#log)\n\n\u003chr /\u003e\n\n### getChannels\n\n**Description:**\n\nReturn array of channel names.\n\n**Parameters:**\n\n- (None)\n\n**Returns:**\n\n- (array)\n\n\u003chr /\u003e\n\n### getDefaultChannel\n\n**Description:**\n\nReturn name of default channel.\n\n**Parameters:**\n\n- (None)\n\n**Returns:**\n\n- (string)\n\n\u003chr /\u003e\n\n### getCurrentChannel\n\n**Description:**\n\nReturn name of current channel.\n\n**Parameters:**\n\n- (None)\n\n**Returns:**\n\n- (string)\n\n\u003chr /\u003e\n\n### addChannel\n\n**Description:**\n\nAdd a logger instance as a new channel with the same name.\n\nIf an existing instance exists with the same name, it will be overwritten.\n\n**Parameters:**\n\n- `$logger` (object): `Monolog\\Logger` object\n\n**Returns:**\n\n- (self)\n\n**Example:**\n\n```php\nuse Bayfront\\MultiLogger\\ChannelName;\nuse Monolog\\Logger;\nuse Monolog\\Handler\\FirePHPHandler;\n\n$audit_channel = new Logger(ChannelName::AUDIT);\n$audit_channel-\u003epushHandler(new FirePHPHandler());\n\n$log-\u003eaddChannel($audit_channel);\n```\n\n\u003chr /\u003e\n\n### isChannel\n\n**Description:**\n\nDoes channel name exist?\n\n**Parameters:**\n\n- `$channel` (string)\n\n**Returns:**\n\n- (bool)\n\n**Example:**\n\n```\nif ($log-\u003eisChannel(ChannelName::APP)) {\n    // Do something\n}\n```\n\n\u003chr /\u003e\n\n### getChannel\n\n**Description:**\n\nReturns `Logger` instance for a given channel.\n\n**Parameters:**\n\n- `$channel = ''` (string): Name of channel to return. If empty string, the current channel will be returned.\n\n**Returns:**\n\n- (object): `Monolog\\Logger` object\n\n**Throws:**\n\n- `Bayfront\\MultiLogger\\Exceptions\\ChannelNotFoundException`\n\n**Example:**\n\n```\ntry {\n\n    $app_channel = $log-\u003egetChannel(ChannelName::APP);\n\n} catch (ChannelNotFoundException $e) {\n    die($e-\u003egetMessage());\n}\n```\n\n\u003chr /\u003e\n\n### channel\n\n**Description:**\n\nSet the channel name to be used for the next logged event.\n\nBy default, all logged events will be logged to the default channel used in the constructor.\n\n**Parameters:**\n\n- `$channel` (string)\n\n**Returns:**\n\n- (self)\n\n**Throws:**\n\n- `Bayfront\\MultiLogger\\Exceptions\\ChannelNotFoundException`\n\n**Example:**\n\n```\ntry {\n    \n    $log-\u003echannel(ChannelName::AUDIT)-\u003einfo('This is an informational log message.');\n    \n} catch (ChannelNotFoundException $e) {\n    die($e-\u003egetMessage());\n}\n```\n\n\u003chr /\u003e\n\n### emergency\n\n**Description:**\n\nSystem is unusable.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### alert\n\n**Description:**\n\nAction must be taken immediately.\n\nExample: Entire website down, database unavailable, etc.\nThis should trigger the SMS alerts and wake you up.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### critical\n\n**Description:**\n\nCritical conditions.\n\nExample: Application component unavailable, unexpected exception.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### error\n\n**Description:**\n\nRuntime errors that do not require immediate action but should typically be logged and monitored.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### warning\n\n**Description:**\n\nExceptional occurrences that are not errors.\n\nExample: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### notice\n\n**Description:**\n\nNormal but significant events.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### info\n\n**Description:**\n\nInteresting events.\n\nExample: User logs in, SQL logs.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### debug\n\n**Description:**\n\nDetailed debug information.\n\n**Parameters:**\n\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)\n\n\u003chr /\u003e\n\n### log\n\n**Description:**\n\nLogs with an arbitrary level.\n\n**Parameters:**\n\n- `$level` (mixed)\n- `$message` (string)\n- `$context` (array)\n\n**Returns:**\n\n- (void)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayfrontmedia%2Fmulti-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbayfrontmedia%2Fmulti-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbayfrontmedia%2Fmulti-logger/lists"}