sadist/logger
Composer 安装命令:
composer require sadist/logger
包简介
A simple yet powerful logging library in PHP which is PSR-3 Compliant.
README 文档
README
Simple yet powerful PSR-3 compliant logger for PHP that is very minimal to use. The best part about being PSR-3 compliant is that, you can replace this library with existing PSR-3 Compliant library like Monolog(https://www.github.com/Seldaek/monolog) in its place when your project surpasses the needs fulfilled by this library.
Features
- Simplicity
- PSR-3 Compliant
- Multiple Log Levels
- Custom Log messages
- Custom Contextual data
Setup
Add the library to your composer.json file in your project:
{
"require": {
"sadist/logger": "*"
}
}
Use composer to install this library:
$ composer install
Composer will install SadistLogger inside your vendor folder. Then you can add the following to your php files to use the library with Autoloading.
require_once "vendor/autoload.php"
Alternatively, use composer on the command line to require and install SadistLogger:
$ composer require "sadist/logger:*"
Minimum Requirements:
- PHP 8.0
Usage
$logfile = "/path/to/logfile.log"
$logLevel = "warning";
$logger = new \Sadist\Logger\SadistLogger($logfile, $loglevel);
$logger->error("Failed to upload data to the server!");
There are following log levels:
- None
$logger->log('none', $message, $context); - Debug
$logger->debug($message, $context); - Info
$logger->info($message, $context); - Notice
$logger->notice($message, $context); - Warning
$logger->notice($message, $context); - Error
$logger->error($message, $context); - Critical
$logger->critical($message, $context); - Alert
$logger->alert($message, $context); - Emergency
$logger->emergency($message, $context);
Note
$context is optional parameter.
LogLevel of none will enable all other logs in the system.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-20