The AnewtLog class provides static methods for logging.
The AnewtLog class provides static methods for logging.
static init($setup_default_handler=false) [static] ¶Initializes the AnewtLog module.
$setup_default_handlerWhether to setup a default handler. If true, a new AnewtLogHandlerDefault instance with default level filtering will be initialized. This parameter defaults to false, which means a log handler needs to be added manually before using the logging facilities.
static add_handler(&$handler, $level=ANEWT_LOG_LEVEL_MESSAGE) [static] ¶Adds a log handler to the list of log handlers.
$handlerA AnewtLogHandlerBase subclass instance
$levelThe minimum log level this handler should log messages for. The default is ANEWT_LOG_LEVEL_MESSAGE, which means that normal messages, warnings, critical warnings and errors are logged. Set to ANEWT_LOG_LEVEL_DEBUG to enable logging of all messages, set to ANEWT_LOG_LEVEL_WARNING to only log warnings and higher priority messages.
static set_domain($domain) [static] ¶Sets the current log domain to the specified domain.
Previous domain names will be remembered (stack-based).
$domainA string with the new domain name.
static reset_domain() [static] ¶Resets the log domain to the previous domain.
static get_domain() [static] ¶Retrieves the current log domain.
static loglevel_to_string($level) [static] ¶Converts a log level integer to a string representation.
$levelThe log level to convert, eg. ANEWT_LOG_LEVEL_MESSAGE
The name for this log level.
static error($message, $args=null) [static] ¶Log an error.
$messageThe message to log, with optional sprintf-style placeholders.
$argsOne or more parameters (or a single array) with values that will be substituted for the placeholders in $message.
static error_with_domain($domain, $message, $args=null) [static] ¶Log an error with a custom domain.
This is particularly useful for library routines.
$domainThe custom domain
$message$argsstatic critical($message, $args=null) [static] ¶Log a critical warning.
static critical_with_domain($domain, $message, $args=null) [static] ¶Log a critical warning with a custom domain.
static warning($message, $args=null) [static] ¶Log a warning.
static warning_with_domain($domain, $message, $args=null) [static] ¶Log a warning with a custom domain.
static message($message, $args=null) [static] ¶Log a normal message.
static message_with_domain($domain, $message, $args=null) [static] ¶Log a normal message with a custom domain.
static info($message, $args=null) [static] ¶Log an informational message.
static info_with_domain($domain, $message, $args=null) [static] ¶Log an informational message with a custom domain.
static debug($message, $args=null) [static] ¶Log a debug message.
static debug_with_domain($domain, $message, $args=null) [static] ¶Log a debug message with a custom domain.
static _is_initialized() [private] [static] ¶Checks if the AnewtLog module was initialized.
True if initialized, false otherwise.
static _log($level, $message, $args=null) [private] [static] ¶Log a message to the output handlers.
$levelThe message log level. This should be one of the ANEWT_LOG_LEVEL_* constants.
$messageThe message itself. sprintf-style placeholders can be specified.
$argsAn array with data (optional). These values will be substituted for the placeholders in $message.
static _log_with_domain($domain, $level, $message, $args) [private] [static] ¶Log a message to the output handlers, temporarily overriding the log domain.