dolibarr 20.0.0
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
31 protected $ident = 0;
32
36 public $errors = [];
37
38
44 public function getName()
45 {
46 return ucfirst($this->code);
47 }
48
54 public function getInfo()
55 {
56 return '';
57 }
58
64 public function getWarning()
65 {
66 return '';
67 }
68
74 public function getVersion()
75 {
76 return 'development';
77 }
78
84 public function isActive()
85 {
86 return 0;
87 }
88
94 public function configure()
95 {
96 return array();
97 }
98
106 public function checkConfiguration()
107 {
108 return true;
109 }
110
117 public function setIdent($ident)
118 {
119 $this->ident += $ident;
120 }
121
129 public function export($content, $suffixinfilename = '')
130 {
131 // Code to output log
132 return;
133 }
134}
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.