dolibarr 21.0.0-alpha
logHandler.php
1<?php
2/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 */
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
24abstract class LogHandler
25{
29 public $code;
30
34 protected $ident = 0;
35
39 public $errors = [];
40
41
47 public function getName()
48 {
49 return ucfirst($this->code);
50 }
51
57 public function getInfo()
58 {
59 return '';
60 }
61
67 public function getWarning()
68 {
69 return '';
70 }
71
77 public function getVersion()
78 {
79 return 'development';
80 }
81
87 public function isActive()
88 {
89 return 0;
90 }
91
97 public function configure()
98 {
99 return array();
100 }
101
109 public function checkConfiguration()
110 {
111 return true;
112 }
113
120 public function setIdent($ident)
121 {
122 $this->ident += $ident;
123 }
124
132 public function export($content, $suffixinfilename = '')
133 {
134 // Code to output log
135 return;
136 }
137}
Parent class for log handlers.
getInfo()
Content of the info tooltip.
checkConfiguration()
Function that checks if the configuration is valid.
getVersion()
Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
export($content, $suffixinfilename='')
Export the message.
configure()
Configuration variables of the module.
getWarning()
Return warning if something is wrong with logger.
getName()
Return name of logger.
isActive()
Is the logger active ?
setIdent($ident)
Set current ident.