PHPackages                             lishaoen/think-log - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. lishaoen/think-log

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

lishaoen/think-log
==================

log package for thinkphp5.1

1.1.3(7y ago)124Apache-2.0PHPPHP &gt;=5.4.0

Since Oct 26Pushed 7y ago1 watchersCompare

[ Source](https://github.com/lishaoen/think-log)[ Packagist](https://packagist.org/packages/lishaoen/think-log)[ RSS](/packages/lishaoen-think-log/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

think-log
=========

[](#think-log)

写入LOG日志，支持文件。

安装

```
composer require lishaoen/think-log

```

用法：

```
$config = [
    //全局唯一标识符
	'app_guid'     => 'DX-php-0002',
	//应用名称
	'app_name'     => '昆港工单系统',
	// 日志记录方式，内置 file socket 支持扩展
	'type'         => 'File',
	// 日志保存目录
	'path'         => RUNTIME_PATH.'admin_logs',
	//日志的时间格式，默认是` c `
	'time_format'   =>'Y-m-d H:i:s',
	// 是否JSON格式记录
	'json'         => true,
	//单个日志文件的大小限制，超过后会自动记录到第二个文件
	'file_size'     =>2097152,
	//是否关闭日志写入
	'close'        => false,
	//允许日志写入的授权key
	'allow_key'    => '',
	// 日志记录级别
	'level'        => ['emergency','alert', 'critical','error','warning','notice','info','debug','sql','login','loginerror'],
	//是否单一文件日志
	'single'      => false,
	//独立记录的日志级别
	//'apart_level' => [],
	'apart_level' => ['emergency','alert', 'critical','error','warning','notice','info','debug','sql','login','loginerror'],
	//最大日志文件数（超过自动清理)
	'max_files'   => 50,
];

//初始化日志类
$log = new \lishaoen\log\Log($config);
//设置用户登录信息
$logAdmin->setCustominfo($userinfo);

//调取日志类方法记录日志
$log->record('error info','error', $context = [],$custominfo = []);
$log->error('error info', $context = [],$custominfo = []);
$log->info('log info', $context = [],$custominfo = []);
$log->save();
或
$log->record($msg='error info',$type ='error', $context = [],$custominfo = [])->save();
$log->error($msg='error info',$context = [],$custominfo = [])->save();

方法参数说明：

/**
 * @param  string $msg       日志信息
 * @param  string $type      日志级别
 * @param  array  $log_custom 日志追加自定义数组字段信息
 * @param  array  $context   替换内容
 */
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2755d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6743b72162f09741e3f2aafb810fe0a3829a93900a5b8fa72ea2b725d315d7b?d=identicon)[lishaoen](/maintainers/lishaoen)

---

Top Contributors

[![lishaoen](https://avatars.githubusercontent.com/u/8002640?v=4)](https://github.com/lishaoen "lishaoen (23 commits)")

### Embed Badge

![Health badge](/badges/lishaoen-think-log/health.svg)

```
[![Health](https://phpackages.com/badges/lishaoen-think-log/health.svg)](https://phpackages.com/packages/lishaoen-think-log)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
