Log4g Reference Manual | ||||
---|---|---|---|---|
Top | Description |
Log4gLogger; Log4gLoggerClass; Log4gLogger * log4g_logger_new (const gchar *name
); const gchar * log4g_logger_get_name (Log4gLogger *self
); void log4g_logger_set_name (Log4gLogger *self
,const gchar *name
); Log4gLogger * log4g_logger_get_parent (Log4gLogger *self
); void log4g_logger_set_parent (Log4gLogger *self
,Log4gLogger *parent
); Log4gLevel * log4g_logger_get_level (Log4gLogger *self
); void log4g_logger_set_level (Log4gLogger *self
,Log4gLevel *level
); gboolean log4g_logger_get_additivity (Log4gLogger *self
); void log4g_logger_set_additivity (Log4gLogger *self
,gboolean additive
); gpointer log4g_logger_get_logger_repository (Log4gLogger *self
); void log4g_logger_set_logger_repository (Log4gLogger *self
,gpointer repository
); Log4gLevel * log4g_logger_get_effective_level (Log4gLogger *self
); void log4g_logger_add_appender (Log4gLogger *self
,Log4gAppender *appender
); const GArray * log4g_logger_get_all_appenders (Log4gLogger *self
); Log4gAppender * log4g_logger_get_appender (Log4gLogger *self
,const gchar *name
); gboolean log4g_logger_is_attached (Log4gLogger *self
,Log4gAppender *appender
); void log4g_logger_remove_all_appenders (Log4gLogger *self
); void log4g_logger_remove_appender (Log4gLogger *self
,Log4gAppender *appender
); void log4g_logger_remove_appender_name (Log4gLogger *self
,const gchar *name
); void log4g_logger_close_nested_appenders (Log4gLogger *self
); void log4g_logger_call_appenders (Log4gLogger *self
,Log4gLoggingEvent *event
); gboolean log4g_logger_is_trace_enabled (Log4gLogger *self
); gboolean log4g_logger_is_debug_enabled (Log4gLogger *self
); gboolean log4g_logger_is_info_enabled (Log4gLogger *self
); gboolean log4g_logger_is_warn_enabled (Log4gLogger *self
); gboolean log4g_logger_is_error_enabled (Log4gLogger *self
); gboolean log4g_logger_is_fatal_enabled (Log4gLogger *self
); Log4gLogger * log4g_logger_get_logger (const gchar *name
); Log4gLogger * log4g_logger_get_root_logger (void
); Log4gLogger * log4g_logger_get_logger_factory (const gchar *name
,gpointer factory
); void log4g_logger_forced_log (Log4gLogger *self
,Log4gLevel *level
,const gchar *function
,const gchar *file
,const gchar *line
,const gchar *format
,va_list ap
); Log4gLevel (*Log4gLoggerGetEffectiveLevel) (Log4gLogger *self
); void (*Log4gLoggerSetLevel) (Log4gLogger *self
,Log4gLevel *level
);
typedef struct { } Log4gLogger;
The Log4gLogger structure does not have any public members.
typedef struct { Log4gLoggerGetEffectiveLevel get_effective_level; Log4gLoggerSetLevel set_level; } Log4gLoggerClass;
Log4gLoggerGetEffectiveLevel |
Retrieve the effective level threshold of the logger. |
Log4gLoggerSetLevel |
Set the level threshold of the logger. |
Log4gLogger * log4g_logger_new (const gchar *name
);
Create a new logger object and set its name.
This fuction is intended for internal use. You should not create Loggers directly.
See
: log4g_logger_get_logger()
|
The fully qualified name for the new logger. |
Returns : |
A new Log4gLogger object. |
Since 0.1
const gchar * log4g_logger_get_name (Log4gLogger *self
);
Retrieve the fully-qualified name of a logger.
|
A Log4gLogger object. |
Returns : |
The name of self .
|
Since 0.1
void log4g_logger_set_name (Log4gLogger *self
,const gchar *name
);
Set the name of a logger.
This method should only be called by sub-classes. Calling this method on a logger in the logger repository will have disastrous effects on the logger hierarchy.
|
A Log4gLogger object. |
|
The new name of self .
|
Since 0.1
Log4gLogger * log4g_logger_get_parent (Log4gLogger *self
);
Retrieve the parent of this logger.
The parent of a logger may change during its lifetime. The root logger
will return NULL
.
|
A Log4gLogger object. |
Returns : |
The parent of self .
|
Since 0.1
void log4g_logger_set_parent (Log4gLogger *self
,Log4gLogger *parent
);
Set the parent of a logger.
|
A Log4gLogger object. |
|
The new parent of self .
|
Since 0.1
Log4gLevel * log4g_logger_get_level (Log4gLogger *self
);
Retrieve the level threshold of a logger.
|
A Log4gLogger object. |
Returns : |
The log level threshold of self .
|
Since 0.1
void log4g_logger_set_level (Log4gLogger *self
,Log4gLevel *level
);
Calls the set_level
function from the Log4gLoggerClass of self
.
|
A Log4gLogger object. |
|
The new log level threshold for self .
|
Since 0.1
gboolean log4g_logger_get_additivity (Log4gLogger *self
);
Retrieve the additivity flag for a logger.
See
: log4g_logger_set_additivity()
|
A Log4gLogger object. |
Returns : |
TRUE if self is additive, FALSE otherwise.
|
Since 0.1
void log4g_logger_set_additivity (Log4gLogger *self
,gboolean additive
);
Set the additivity flag for a logger.
Logger additivity determines if a logger inherits the appenders of its
ancestors. If this flag is set to TRUE
(the default value is TRUE
)
then events logged to this logger will be propagated to the appenders of
its ancestors. If this flags is set to FALSE
then the appenders of this
logger will not be inherited.
|
A Log4gLogger object. |
|
The new additivity flag for self .
|
Since 0.1
gpointer log4g_logger_get_logger_repository (Log4gLogger *self
);
Retrieve the repository where a logger is attached. See Log4gLoggerRepositoryInterface.
|
A Log4gLogger object. |
Returns : |
The logger repository self is attached to.
|
Since 0.1
void log4g_logger_set_logger_repository (Log4gLogger *self
,gpointer repository
);
Set the repository a logger is attached to.
You probably do not want to call this function.
See
: Log4gLoggerRepositoryInterface
|
A Log4gLogger object. |
|
The new repository to attach to self .
|
Since 0.1
Log4gLevel * log4g_logger_get_effective_level (Log4gLogger *self
);
Calls the get_effective_level
function from the Log4gLoggerClass of self
.
|
A Log4gLogger object. |
Returns : |
The effective level threshold of self .
|
Since 0.1
void log4g_logger_add_appender (Log4gLogger *self
,Log4gAppender *appender
);
Add an appender to the list of appenders for self
.
If appender
is already in the list of appenders for self
then
it will not be added again.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
|
The appender to add to self .
|
Since 0.1
const GArray * log4g_logger_get_all_appenders (Log4gLogger *self
);
Retrieve all appenders attached to a self
.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
Returns : |
A GArray of appenders attached to self or NULL if there are
none.
|
Since 0.1
Log4gAppender * log4g_logger_get_appender (Log4gLogger *self
,const gchar *name
);
Retrieve an appender attached to a logger by name.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
|
The name of the appender to retrieve. |
Returns : |
The appender named name or NULL if no such appender is attached.
|
Since 0.1
gboolean log4g_logger_is_attached (Log4gLogger *self
,Log4gAppender *appender
);
Determine if an appender is attached to a logger.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
|
An appender object. |
Returns : |
TRUE if appender is attached to self , FALSE otherwise.
|
Since 0.1
void log4g_logger_remove_all_appenders (Log4gLogger *self
);
Remove all appenders from a logger.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
Since 0.1
void log4g_logger_remove_appender (Log4gLogger *self
,Log4gAppender *appender
);
Remove an appender from a logger.
If appender
is not attached to self
then this function does nothing.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
|
An appender to remove. |
Since 0.1
void log4g_logger_remove_appender_name (Log4gLogger *self
,const gchar *name
);
Remove an appender from a logger by name.
If name
is not found then this function does nothing.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
|
The name of the appender to remove. |
Since 0.1
void log4g_logger_close_nested_appenders (Log4gLogger *self
);
Close all attached appenders implementing the Log4gAppenderAttachable interface.
See
: Log4gAppenderAttachableInterface
|
A Log4gLogger object. |
Since 0.1
void log4g_logger_call_appenders (Log4gLogger *self
,Log4gLoggingEvent *event
);
Append a logging event to all appenders attached to this logger.
See
: Log4gLoggingEvent
|
A Log4gLogger object. |
|
An event to log. |
Since 0.1
gboolean log4g_logger_is_trace_enabled (Log4gLogger *self
);
Check if a logger is enabled for the LOG4G_LEVEL_TRACE
level.
This function is useful if you have a to perform a costly operation to construct a log message.
|
A Log4gLogger object. |
Returns : |
TRUE if self is enabled for the LOG4G_LEVEL_TRACE level, FALSE
otherwise.
|
Since 0.1
gboolean log4g_logger_is_debug_enabled (Log4gLogger *self
);
Check if a logger is enabled for the LOG4G_LEVEL_DEBUG
level.
|
A Log4gLogger object. |
Returns : |
TRUE if self is enabled for the LOG4G_LEVEL_DEBUG level, FALSE
otherwise.
|
Since 0.1
gboolean log4g_logger_is_info_enabled (Log4gLogger *self
);
Check if a logger is enabled for the LOG4G_LEVEL_INFO
level.
|
A Log4gLogger object. |
Returns : |
TRUE if self is enabled for the LOG4G_LEVEL_INFO level, FALSE
otherwise.
|
Since 0.1
gboolean log4g_logger_is_warn_enabled (Log4gLogger *self
);
Check if a logger is enabled for the LOG4G_LEVEL_WARN
level.
|
A Log4gLogger object. |
Returns : |
TRUE if self is enabled for the LOG4G_LEVEL_WARN level, FALSE
otherwise.
|
Since 0.1
gboolean log4g_logger_is_error_enabled (Log4gLogger *self
);
Check if a logger is enabled for the LOG4G_LEVEL_ERROR
level.
|
A Log4gLogger object. |
Returns : |
TRUE if self is enabled for the LOG4G_LEVEL_ERROR level, FALSE
otherwise.
|
Since 0.1
gboolean log4g_logger_is_fatal_enabled (Log4gLogger *self
);
Check if a logger is enabled for the LOG4G_LEVEL_FATAL
level.
|
A Log4gLogger object. |
Returns : |
TRUE if self is enabled for the LOG4G_LEVEL_FATAL level, FALSE
otherwise.
|
Since 0.1
Log4gLogger * log4g_logger_get_logger (const gchar *name
);
Retrieve a named logger.
If the named logger already exists, then the existing instance will be returned. Otherwise a new instance is created.
Loggers inherit their default level from their nearest ancestor with a set level.
|
The name of the logger to retrieve. |
Returns : |
The logger named name .
|
Since 0.1
Log4gLogger * log4g_logger_get_root_logger (void
);
Retrieve the root logger for the current logger repository.
Calling log4g_logger_get_name()
on the root logger always returns the
string "root". Calling log4g_logger_get_logger("root") however does not
retrieve the root logger but a logger just under root named "root".
Calling this function is the only way to retrieve the root logger.
Returns : |
The root logger. |
Since 0.1
Log4gLogger * log4g_logger_get_logger_factory (const gchar *name
,gpointer factory
);
Retrieve a named logger.
If the named logger already exists, then the existing instance will be
returned. Otherwise factory
is used to create a new instance.
|
The name of the logger to retrieve. |
|
The logger factory to use if a logger named name does not already
exist.
|
Returns : |
The logger named name .
|
Since 0.1
void log4g_logger_forced_log (Log4gLogger *self
,Log4gLevel *level
,const gchar *function
,const gchar *file
,const gchar *line
,const gchar *format
,va_list ap
);
Create and log a new event without further checks.
|
A Log4gLogger object. |
|
The level of the log event. |
|
The function where the event was logged. |
|
The file where the event was logged. |
|
The line in file where the event was logged.
|
|
A printf message format. |
|
Format parameters. |
Since 0.1
Log4gLevel (*Log4gLoggerGetEffectiveLevel) (Log4gLogger *self
);
Starting from this category, search the category hierarchy for a
non-NULL
and return it. If a non-NULL
level is not found, this
function returns the level of the root logger.
|
A Log4gLogger object. |
Returns : |
The effective level threshold of self .
|
Since 0.1
void (*Log4gLoggerSetLevel) (Log4gLogger *self
,Log4gLevel *level
);
|
A Log4gLogger object. |
|
The new level threshold for self . NULL values are permitted.
|
Since 0.1