Rechercher une page de manuel
NOCpulse::Log::LogManager.3pm
Langue: en
Version: 2009-02-04 (fedora - 06/07/09)
Section: 3 (Bibliothèques de fonctions)
Sommaire
NAME
NOCpulse::Log::LogManager - Manager of fine-grain logging objectsSYNOPSIS
use NOCpulse::Log::LogManager;NOCpulse::Log::LogManager->instance()->add_stream(FILE => 'foo.log', APPEND => 1, TIMESTAMPS => 1); NOCpulse::Log::LogManager->instance()->configure( 'NOCpulse::Scheduler' => 1, 'NOCpulse::Scheduler::Event.pm' => 2); 'NOCpulse::Scheduler::Event::PluginEvent' => 4); NOCpulse::Log::LogManager->instance()->add_configuration('NOCpulse::Probe' => 2);
DESCRIPTION
"LogManager" manages level configuration and output for "Logger"s. It keeps track of all instantiated loggers.Output is handled by the "Debug" module (see Debug). The "add_stream" and "stream" methods call through to "Debug-"addstream> and take the corresponding arguments.
Configuration is via hash entries keyed by package name or prefix. For instance, in the example above, any module that includes ``Scheduler'' in its name will be assigned a level of one, while the ``PluginEvent'' module is assigned a level of four. A logger without a specifcally assigned level walks up to find the first defined level above it.
You normally use "LogManager" only during initialization; logging calls do not refer to the manager.
METHODS
- instance()
- Returns the global singleton instance. You cannot create new instances. By default the instance logs to STDOUT.
- add_stream(%args)
- Adds an output stream. See Debug for details of %args.
- del_stream(%args)
- Removes an output stream. See Debug for details of %args.
- stream(%args)
- Sets up a single output stream. See Debug for details of %args.
- configure(%args)
- Configures the log level namespace from a hash. Keys are package names or prefixes, values are level integers. Replaces any existing configuration.
- add_configuration(%args)
- Adds to an existing log level namespace configuration.
- read_config_file([$filename])
- Reads logging configuration from an ini file. Defaults to logging.ini in the directory named by the netsaint/configDir property in NOCpulse.ini, /etc/nocpulse.
- add_logger($logger)
- Adds a logger and sets its level based on the current namespace. This is called from "Logger->new" but should not usually be called from other packages.
- level($package_name)
- Returns the level assigned to $package_name. It first looks for a specific entry for $package_name, then for each prefix (separated by ``::''), and finally for an entry named ``all''. Returns undef if there is no matching level anywhere in the namespace.
- print(%args)
- Unconditionally prints to the current output streams.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre