从PHP中将日志信息简单写入txt文件的方法。

1.0.0 2018-11-10 17:51 UTC

This package is not auto-updated.

Last update: 2024-09-23 20:54:16 UTC


README

从PHP中将日志信息简单写入txt文件的方法

关键特性

  • 简单地将变量信息写入文件的方法
  • 支持不同类型的信息,例如:字符串、整数、数组、布尔值、null

一些示例

setPath

设置日志文件文件夹的路径。

// Description:
void setPath ( string $path )

// example:
LOG::setPath('Here path to log folder');

clear

清除当前日志文件。

// Description:
void clear ()

// example:
LOG::clear();

write

// Description:
void write ( string|array|boolean|int|null $text [, string $title = null [, string $filename = null ]] )

// example:
LOG::write('Here is your log information','Log title', 'test');

// result in file - 25.06.2017.test.log.txt
// [2017.06.25][06:50:30][Log title] string(28) "Here is your log information"

writeError

// Description:
void writeError ( string $text [, string $title = null ] )

// example:
LOG::writeError('Here is your error log information','Error log title');

// result in file - 25.06.2017.error.log.txt
// [2017.06.25][07:22:01][Error log title] string(34) "Here is your error log information"

writeException

// Description:
void writeException ( Exception $e [, string $title = null ] )

// example:
LOG::writeException('Here is exception object','Exception information');

border

// Description:
void border ( [ string $title = 'BORDER' ] )

// example:
LOG::border('Border title');
// result in file - 25.06.2017.log.txt
//////////Border title////////////////////////////////////////////////////////////////////////////////