1 | <?php |
||
11 | class ActivityLogger |
||
12 | { |
||
13 | /** |
||
14 | * Log an activity. |
||
15 | * |
||
16 | * @param string $message A basic message |
||
17 | * @param array $context Any additional data you might want to save. |
||
18 | * @param timestamp $date Timestamp of when it's happened. If none is passed the current timestamp will be used. |
||
19 | * @return void |
||
20 | */ |
||
21 | public function log($message, $context = [], $date = null) |
||
33 | |||
34 | /** |
||
35 | * Get all data from one log entry. |
||
36 | * |
||
37 | * @param int $id The id of the log. |
||
38 | * @return object |
||
39 | */ |
||
40 | public function getLog($id) |
||
44 | |||
45 | /** |
||
46 | * Get all data from all logs. |
||
47 | * |
||
48 | * @return object |
||
49 | */ |
||
50 | public function getAllLogs() |
||
54 | |||
55 | /** |
||
56 | * Get all logs created within a given timespan. |
||
57 | * |
||
58 | * @param timestamp $start Every log created after this date. |
||
59 | * @param timestamp $end Every log created before this date. |
||
60 | * @return array |
||
61 | */ |
||
62 | public function getLogsBetween($start, $end) |
||
66 | |||
67 | /** |
||
68 | * Get the most recent logs. |
||
69 | * |
||
70 | * @param int $number (optional) The number of logs to retrieve, default is 5. |
||
71 | * @return object |
||
72 | */ |
||
73 | public function getRecentLogs($number = 5) |
||
77 | |||
78 | /** |
||
79 | * Delete all logs (not way back!). |
||
80 | * @return void |
||
81 | */ |
||
82 | public function deleteAll() |
||
86 | } |
||
87 |