edujugon/laravel-log
最新稳定版本:1.2.0
Composer 安装命令:
composer require edujugon/laravel-log
包简介
Simple API to write logs for Laravel.
README 文档
README
Simple API to write logs for Laravel.
Installation
Type in console:
composer require edujugon/laravel-log
Laravel 5.5 or higher?
Then you don't have to either register or add the alias, this package uses Package Auto-Discovery's feature, and should be available as soon as you install it via Composer.
(Laravel < 5.5) Register the Log service by adding it to the providers array.
'providers' => array(
...
Edujugon\Log\Providers\LogServiceProvider::class
)
Publish the package's configuration file to the application's own config directory.
php artisan vendor:publish --provider="Edujugon\Log\Providers\LogServiceProvider" --tag="config"
The above command will generate a new file under your laravel app config folder called log.php
Configuration
Update the log.php file with your data.
API List
path
path method sets the path where create / storage the log file.
Syntax
Edujugon\Log\Log object path($path)
level
level method sets the logging level.
Available levels: emergency, alert, critical, error, warning, notice, info and debug.
Syntax
Edujugon\Log\Log object level($level)
title
title method sets the title or main message to be written.
Syntax
Edujugon\Log\Log object title($title)
line
line method sets a line below the title.
Notice that you can call this method as many time as lines you need to be written.
Syntax
Edujugon\Log\Log object line($line)
logname
name method sets the logger name.
By default this name is "my-logger"
Syntax
Edujugon\Log\Log object name($loggerName)
fileName
fileName method sets the file name.
Remember to put the name without any extension.
Syntax
Edujugon\Log\Log object fileName($name)
days
days method sets amount of days to be kept in server.
Syntax
Edujugon\Log\Log object days($days)
A value "0" means no day limit
withoutDateTime
withoutDateTime method excludes datetime from log line.
Syntax
Edujugon\Log\Log object withoutDateTime()
withoutLoggerDetails
withoutLoggerDetails method excludes logger details from log line.
Syntax
Edujugon\Log\Log object withoutLoggerDetails()
Exclude logger name and level
write
write method writes in log file.
Syntax
boolean write()
Usage samples
$log = new Log();
$log->fileName('my-personal-log')
->title('Stored new record')
->line('the record id is 3')
->line('Stored by John')
->line('This is antoher line')
->days(3)
->write();
Also can do it by its Facade:
Log::fileName('my-personal-log')
->title('Stored new record')
->line('the record id is 3')
->line('Stored by John')
->line('This is antoher line')
->write();
edujugon/laravel-log 适用场景与选型建议
edujugon/laravel-log 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.73k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2017 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「monolog」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 edujugon/laravel-log 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 edujugon/laravel-log 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 edujugon/laravel-log 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A GeoIP decorator/processor for monolog
A Zend Framework module that sets up Monolog for logging in applications.
Laravel 5.6 Monolog custom telegram channel
A Monolog processor to add X-Request-Id or UNIQUE_ID env to monolog stack if present, provide a default one otherwise. Optionally, add a forwarded request-id list.
PSR-3 compatible logger with dynamic file naming and hourly rotation, powered by Monolog
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
统计信息
- 总下载量: 10.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-22