ocean.util.log.Config

Utility functions to configure tango loggers from a config file.

Configures tango loggers, uses the AppendSyslog class to provide logfile rotation.

In the config file, a logger can be configured using the following syntax:

; Which logger to configure. In this case LoggerName is being configured. ; A whole hierachy can be specified like LOG.MyApp.ThatOutput.X ; And each level can be configured. LOG.LoggerName

; Whether to output to the terminal ; warn, error, and fatal are written to stderr, info and trace to stdout console = true

; File to output to, no output to file if not given file = log/logger_name.log

; Whether to propagate the options down in the hierachy propagate = false

; The verbosity level, corresponse to the tango logger levels level = info

; Is this logger additive? That is, should we walk ancestors ; looking for more appenders? additive = true

Note that LOG.Root will be treated specially: it will configure the 'root' logger, which is the parent of all loggers. Root is case insensitive, so LOG.root or LOG.ROOT will work as well.

See the class Config for further options and documentation.

There are global logger configuration options as well:

; Global options are in the section LOG LOG

; Buffer size for output buffer_size = 2048

See the class MetaConfig for further options and documentation.

Upon calling the configureLoggers function, logger related configuration will be read and the according loggers configured accordingly.

Usage Example (you probably will only need to do this):

import Log = ocean.util.log.Config;
// ...
Log.configureLoggers(Config().iterateCategory!(Log.Config)("LOG"),
                     Config().get!(Log.MetaConfig)("LOG"));

Members

Aliases

ConfigIterator
alias ConfigIterator = ocean.util.config.ConfigFiller.ConfigIterator!(Config, ConfigParser)

Convenience alias for iterating over Config classes

Layout
alias Layout = Appender.Layout

Convenience alias for layouts

Classes

Config
class Config

Configuration class for loggers

MetaConfig
class MetaConfig

Configuration class for logging

Functions

configureLogger
void configureLogger(Logger log, Config settings, istring name, Appender delegate(istring file, Layout layout) file_appender, Appender delegate(Layout) console_appender, bool console_enabled, bool syslog_enabled, size_t buffer_size, Layout delegate(cstring) makeLayout)

Sets up logging configuration. Calls the provided file_appender delegate once per log being configured and passes the returned appender to the log's add() method.

configureNewLoggers
void configureNewLoggers(ConfigIterator config, MetaConfig m_config, Appender delegate(istring file, Layout layout) file_appender, Layout delegate(cstring) makeLayout, bool use_insert_appender)

Sets up logging configuration for ocean.util.log.Logger

configureNewLoggers
void configureNewLoggers(ConfigIterator config, MetaConfig m_config, Appender delegate(istring file, Layout layout) file_appender, bool use_insert_appender)

Sets up logging configuration for ocean.util.log.Logger

newLayout
Layout newLayout(cstring layout_str)

Gets a new layout instance, based on the given name.

setupLoggerLevel
void setupLoggerLevel(Logger log, istring name, Config config)

Sets up the level configuration of a logger.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).