Monolog

将您的日志发送到文件、套接字、收件箱、数据库和各种 Web 服务。「Sends your logs to files, sockets, inboxes, databases and various web services」

Github stars Tracking Chart

Monolog -- PHP 的日志记录

Monolog 会将您的日志发送到文件、套接字、收件箱、数据库和各种 Web 服务。请参阅以下处理程序的完整列表。特殊的处理程序允许您构建高级日志策略。

这个库实现了 PSR-3 接口,您可以在自己的库中输入提示,以保持最大的互操作性。您还可以在应用程序中使用它,以确保以后始终可以使用另一个兼容的日志程序。从 1.11.0 开始,公共 api 也将接受 PSR-3 日志级别。在内部独白仍然使用自己的级别方案,因为它早于 PSR-3。

安装方法

安装最新版本

$ composer require monolog/monolog

基本使用

<?php

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

// add records to the log
$log->warning('Foo');
$log->error('Bar');

文档

在经济上支持 Monolog

获得 Monolog 的支持,并通过 Tidelift 订阅 或通过 GitHub 赞助 来帮助资助该项目。
Tidelift 为您用于构建应用程序的开源依赖提供商业支持和维护。节省时间,降低风险,提高代码健康度,同时向您所使用的依赖程序的维护者支付费用。

第三方软件包

第三方处理程序、格式化程序和处理器都在维基中列出。如果你发布了一个,你也可以在那里添加你自己的。

关于

要求

  • Monolog 2.x 适用于 PHP 7.2 或以上版本,使用 Monolog ^1.0 支持 PHP 5.3 以上版本。

提交错误和功能请求

错误和功能请求在 GitHub 上进行跟踪。

框架整合

作者

Jordi Boggiano - j.boggiano@seld.be - http://twitter.com/seldaek

也请看参与本项目的 贡献者 名单。

许可证

Monolog 是在 MIT 许可下授权的,详情请参见 LICENSE 文件。

鸣谢

这个库的灵感很大程度上来自于 Python 的 Logbook 库,尽管大部分概念已经被调整以适应 PHP 世界。


(The first version translated by vz on 2020.09.24)

Overview

Name With OwnerSeldaek/monolog
Primary LanguagePHP
Program languagePHP (Language Count: 1)
PlatformBSD, Linux, Mac, Solaris, Windows
License:MIT License
Release Count80
Last Release Name3.6.0 (Posted on )
First Release Name1.0.0-RC1 (Posted on )
Created At2011-02-17 02:07:15
Pushed At2024-04-19 15:05:13
Last Commit At
Stargazers Count20.8k
Watchers Count318
Fork Count1.9k
Commits Count2.8k
Has Issues Enabled
Issues Count806
Issue Open Count30
Pull Requests Count692
Pull Requests Open Count5
Pull Requests Close Count380
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Monolog - Logging for PHP Build Status

Total Downloads
Latest Stable Version

Monolog sends your logs to files, sockets, inboxes, databases and various
web services. See the complete list of handlers below. Special handlers
allow you to build advanced logging strategies.

This library implements the PSR-3
interface that you can type-hint against in your own libraries to keep
a maximum of interoperability. You can also use it in your applications to
make sure you can always use another compatible logger at a later time.
As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels.
Internally Monolog still uses its own level scheme since it predates PSR-3.

Installation

Install the latest version with

$ composer require monolog/monolog

Basic Usage

<?php

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

// add records to the log
$log->warning('Foo');
$log->error('Bar');

Documentation

Support Monolog Financially

Get supported Monolog and help fund the project with the Tidelift Subscription or via GitHub sponsorship.

Tidelift delivers commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use.

Third Party Packages

Third party handlers, formatters and processors are
listed in the wiki. You
can also add your own there if you publish one.

About

Requirements

  • Monolog 2.x works with PHP 7.2 or above, use Monolog ^1.0 for PHP 5.3+ support.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub

Framework Integrations

Author

Jordi Boggiano - j.boggiano@seld.be - http://twitter.com/seldaek
See also the list of contributors who participated in this project.

License

Monolog is licensed under the MIT License - see the LICENSE file for details

Acknowledgements

This library is heavily inspired by Python's Logbook
library, although most concepts have been adjusted to fit to the PHP world.

To the top