lenoxzzedwin / simple-log
一个简单的包,用于将所有消息和变量集写入文件,灵感来源于 https://www.redips.net/php/write-to-log-file
v1.2.0
2018-02-13 05:18 UTC
This package is not auto-updated.
Last update: 2024-09-21 17:41:41 UTC
README
一个简单的包,用于将所有消息和变量集写入文件,灵感来源于 https://www.redips.net/php/write-to-log-file
安装
$ composer require lenoxzzedwin/simple-log
基本用法
<?php require __DIR__ . '/vendor/autoload.php'; // or your path use Lenoxzzedwin\SimpleLog\SimpleLog; $log = new SimpleLog(); $log->lfile('path'); //load file $log->lwrite(['hello','world']); // array $log->lwrite('Hello World'); // string $data = ['person' => ['name'=>'Edwin']]; $log->lwrite( (object) $data); //object ALL! $log->lclose();
file.txt
[Tue Feb 13 5:17:27 2018] (/tests/test.php) Array
(
[0] => hello
[1] => world
)
[Tue Feb 13 5:17:27 2018] (/tests/test.php) Hello World
[Tue Feb 13 5:17:27 2018] (/tests/test.php) stdClass Object
(
[person] => Array
(
[name] => Edwin
)
)
tail -f?
非常适合与 tail -f 一起使用
许可证
MIT