amattu2/event-logger
最新稳定版本:v1.0.0
Composer 安装命令:
composer require amattu2/event-logger
包简介
A lightweight, basic PHP 7+ event message logger that eases the workload of writing and generating timestamped events.
README 文档
README
This is a basic PHP event logger class for writing HTML based event logs.
Usage
addEvent
This function is used to add a new event log. Optionally override the default timestamp (now).
/** * Add a new event to the log * * @param string $text event content * @param ?DateTime $timestamp event timestamp * @return boolean success * @author Alec M. */ public function addEvent(string $text, \DateTime $timestamp = null) : bool
getStartTime
This function returns the exact DateTime for the timestamp of the first event added.
/** * Return first event timestamp * * @return \DateTime */ public function getStartTime() : \DateTime
getEndTime
This function returns the timestamp as a DateTime for the last time an event was added to the log.
/** * Return last event timestamp * * @return \DateTime */ public function getEndTime() : \DateTime
getEvents
This returns the event log as an array.
/** * Return collection of events * * @return array */ public function getEvents() : array
getEventsTable
This returns the event log formatted as an HTML table. Optionally override the DateTime format for events.
/** * Return the event list as a HTML table * * @param string $date_format DateTime format string * @return string HTML table */ public function getEventsTable(string $date_format = "Y-m-d G:i:s") : string
Requirements & Dependencies
PHP 7+ or above
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0
- 更新时间: 2023-03-09