phasty/log 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phasty/log

Composer 安装命令:

composer require phasty/log

包简介

PHP log library

README 文档

README

Class Phasty\Log\File provides ability to log into files.

If you have to log many data in production you can meet problems with reading logs soon.

First problem is that usually log file grows fast and it becomes too hard to read such log file with utilities like less, so navigation over this file becomes unreal.

Second problem is that log rows should have enough information to make decision how to solve your issue.

Current version of logger class allows you to split log files by time as you decide: by days, by hours or by minutes. Log file changes silently, you should only supply mask for path to file if default is not what you want. Default is:

log/%Y/%m/%d/%H/

At 15:00 of 03/10/2014 file will be in log/2014/03/10/15/ directory. Default file name is "log", so full file path becomes log/2014/03/10/15/log.log . If you want to divide different type of logged data into different files you can change default file name at configuration time or at runtime.

Each log line is formatted according to configuration and can include next information automatically in line header:

Level of logging
PID of process
Exact time (microseconds to if needed)
Used memory

Log message may be spaced from log header by special spacer, default is "+-". For example:

[D 13762, 20:13.0250, 1048576 ] +-That is debug-level log message
[E 13762, 20:13.0261, 1048576 ] +-That is error-level log message

Moreover, by default each log line header is highlighted in file according to it's logging level:

USAGE

use Phasty\Log\File as log;

log::debug("This is debug message");
log::info("This is info message");
log::notice("This is notice message");
log::success("This is success message");
log::warning("This is warning message");
log::error("This is error message");

Configuration

config/log.php:

<?php
return [
    "spacer" => "+-----",
    "header" => [
        "color"  => "brown",
        "format" => "[^PID, %H:%i:%s.^MCT]"
    ],
    "name" => "queue"
];

using:

use Phasty\Log\File as log;
log::config(require "config/log.php");
log::info("log message");

统计信息

  • 总下载量: 14.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固