Home « Server software «
Documentation: agents/logger.php
class Logger - Log strings
Use functions of this library in your code depending on the expected effect:- Logger::debug() should be reserved during development, integration and debugging
- Logger::remember() stores an event locally, for later review
- Logger::notify() stores an event and also sends an e-mail message to site admins
This script is a reference file of this system.
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
debug() - Remember a string during software debug
function debug($value='', $label=NULL)
- $value='' - mixed something to be printed
- $label=NULL - string an optional label string
- returns void
get_tail() - Get the latest events
function get_tail($count=20, $variant='all')
- $count=20 - int the number of events - default is 20
- $variant='all' - string variant - default is 'all'
- returns an array of ($stamp, $surfer, $script, $label, $description)
notify() - Notify an event
function notify($script, $label, $description='')
- $script - string the source script (e.g., 'articles/edit.php')
- $label - string a one-line label that can be used as a mail title (e.g. 'creation of a new article')
- $description='' - string a more comprehensive description, if any
- returns void
Logger::remember()
to save the event locally, then attempts to send an e-mail
message if possible.The description is truncated after 4 kbytes.
remember() - Remember an event
function remember($script, $label, $description='', $store='log')
- $script - string the source script (e.g., 'articles/edit.php')
- $label - string a one-line label that can be used as a mail title (e.g. 'creation of a new article')
- $description='' - mixed a more comprehensive description, if any
- $store='log' - string either 'log' or 'debug'
- returns void
It the selected store is 'log', the function also submits a message to
syslog()
, to enable
distributed logging.Each line of the log store is made of fields separated by tabulations:
- time stamp (year-month-day hour:minutes:seconds)
- surfer name, if any, or '-'
- script calling this function (e.g., control/configure.php)
- the label
- the description, if any
Each line of the debug store is made of fields separated by tabulations:
- time stamp (year-month-day hour:minutes:seconds)
- script calling this function (e.g., control/configure.php)
- the label
- the description, if any
to_string() - Make a string out of something
function &to_string($value='')
- $value='' - mixed something to be printed
- returns string