GfLog

GfLog — GfLog Object API

Synopsis




#define     GF_LOG_DEFAULT
enum        GfLogLevel;
            GfLog;
GfLog*      gf_log_new                      (void);
void        gf_log_open                     (GfLog *log);
void        gf_log_vargs                    (GfLog *log,
                                             GfLogLevel level,
                                             const gchar *category,
                                             const gchar *format,
                                             va_list args);
void        gf_log                          (GfLog *log,
                                             GfLogLevel level,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);
void        gf_log_critical                 (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);
void        gf_log_warning                  (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);
void        gf_log_event                    (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);
void        gf_log_info                     (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);
void        gf_log_verbose                  (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);
void        gf_log_close                    (GfLog *log);
void        gf_log_set_level                (GfLog *log,
                                             GfLogLevel level);
GfLogLevel  gf_log_get_level                (GfLog *log);
void        gf_log_set_timestamp_format     (GfLog *log,
                                             const gchar *format);
const gchar* gf_log_get_timestamp_format    (const GfLog *log);
void        gf_log_set_timestamp_visible    (GfLog *log,
                                             gboolean value);
gboolean    gf_log_get_timestamp_visible    (const GfLog *log);
#define     gf_log_level_from_string        (str)
#define     gf_log_level_to_string          (level, i18n)
void        gf_logs_set_default_log         (GfLog *log);
GfLog*      gf_logs_get_default_log         (void);

Object Hierarchy


  GObject
   +----GfObject
         +----GfLog
               +----GfLogFile

Properties


  "level"                GfLogLevel            : Read / Write
  "ts-format"            gchararray            : Read / Write
  "ts-visible"           gboolean              : Read / Write

Description

GfLog is the base class of all loggers. It is also a console logger that will log output directly to the console.

Details

GF_LOG_DEFAULT

#define GF_LOG_DEFAULT			NULL

An identifier to tell the log writing API to use the default log.


enum GfLogLevel

typedef enum _GfLogLevel {
	GF_LOG_LEVEL_UNKNOWN = -1,
	GF_LOG_LEVEL_VERBOSE = 0,
	GF_LOG_LEVEL_INFO,
	GF_LOG_LEVEL_EVENT,
	GF_LOG_LEVEL_WARNING,
	GF_LOG_LEVEL_CRITICAL,
	GF_LOG_LEVELS
} GfLogLevel;

The different levels of logging.

GF_LOG_LEVEL_UNKNOWN Unknown.
GF_LOG_LEVEL_VERBOSE Logs everything.
GF_LOG_LEVEL_INFO Logs critical, warning, event and info entries.
GF_LOG_LEVEL_EVENT Logs critical, warning, and event entries.
GF_LOG_LEVEL_WARNING Logs critical and warning entries.
GF_LOG_LEVEL_CRITICAL Only logs critical entries.
GF_LOG_LEVELS Total levels.

GfLog

typedef struct _GfLog GfLog;

GfLog is an opaque structure that should not be used directly.


gf_log_new ()

GfLog*      gf_log_new                      (void);

Creates a new console logger.

Returns : A new instance of GfLog.

gf_log_open ()

void        gf_log_open                     (GfLog *log);

Opens a log.

log : The GfLog instance.

gf_log_vargs ()

void        gf_log_vargs                    (GfLog *log,
                                             GfLogLevel level,
                                             const gchar *category,
                                             const gchar *format,
                                             va_list args);

Writes to log.

log : The GfLog instance.
level : The GfLogLevel for the entry.
category : The category for the entry.
format : The format for the entry.
args : The arguments for format.

gf_log ()

void        gf_log                          (GfLog *log,
                                             GfLogLevel level,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);

Writes to log.

log : The GfLog instance.
level : The GfLogLevel for the entry.
category : The category for the entry.
format : The format for the entry.
... : The arguments for format.

gf_log_critical ()

void        gf_log_critical                 (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);

Writes a critical entry to log.

log : The GfLog instance.
category : The category for the entry.
format : The format for the entry.
... : The arguments for format.

gf_log_warning ()

void        gf_log_warning                  (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);

Writes a warning entry to log.

log : The GfLog instance.
category : The category for the entry.
format : The format for the entry.
... : The arguments for format.

gf_log_event ()

void        gf_log_event                    (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);

Writes an event entry to log.

log : The GfLog instance.
category : The category for the entry.
format : The format for the entry.
... : The arguments for format.

gf_log_info ()

void        gf_log_info                     (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);

Writes an information entry to log.

log : The GfLog instance.
category : The category for the entry.
format : The format for the entry.
... : The arguments for format.

gf_log_verbose ()

void        gf_log_verbose                  (GfLog *log,
                                             const gchar *category,
                                             const gchar *format,
                                             ...);

Writes a verbose entry to log.

log : The GfLog instance.
category : The category for the entry.
format : The format for the entry.
... : The arguments for format.

gf_log_close ()

void        gf_log_close                    (GfLog *log);

Closes log.

log : The GfLog instance.

gf_log_set_level ()

void        gf_log_set_level                (GfLog *log,
                                             GfLogLevel level);

Sets the GfLogLevel of log to be level. Which means only entries up to and including level will be output to log.

log : The GfLog instance.
level : The new GfLogLevel.

gf_log_get_level ()

GfLogLevel  gf_log_get_level                (GfLog *log);

Gets the GfLogLevel from log.

log : The GfLog instance.
Returns : The current GfLogLevel of log.

gf_log_set_timestamp_format ()

void        gf_log_set_timestamp_format     (GfLog *log,
                                             const gchar *format);

Sets the timestamp format of log to format.

log : The GfLog instance.
format : The new timestamp format in strftime format.

gf_log_get_timestamp_format ()

const gchar* gf_log_get_timestamp_format    (const GfLog *log);

Gets the timestamp format of log.

log : The GfLog instance.
Returns : The timestamp format of log.

gf_log_set_timestamp_visible ()

void        gf_log_set_timestamp_visible    (GfLog *log,
                                             gboolean value);

Sets whether or not to show timestamps in log.

Note: It is up to the individual log implementations to enforce this.

log : The GfLog instance.
value : TRUE to show timestamps, FALSE to hide them.

gf_log_get_timestamp_visible ()

gboolean    gf_log_get_timestamp_visible    (const GfLog *log);

Gets whether or not timestamps are being shown for log.

log : The GfLog instance.
Returns : TRUE if timestamps are visible, FALSE otherwise.

gf_log_level_from_string()

#define     gf_log_level_from_string(str)

Gets a GfLogLevel from a string.

Note str MUST be the untranslated string!

str : The string.
Returns : The GfLogLevel.

gf_log_level_to_string()

#define     gf_log_level_to_string(level, i18n)

Gets a string from a GfLogLevel

level : The GfLogLevel.
i18n : TRUE for the translated string.
Returns : style as a string.

gf_logs_set_default_log ()

void        gf_logs_set_default_log         (GfLog *log);

Sets the default log for the GfLog subsystem.

log : A valid GfLog instance.

gf_logs_get_default_log ()

GfLog*      gf_logs_get_default_log         (void);

Gets the default log of the GfLog subsystem.

Returns : The default GfLog.

Properties

The "level" property

  "level"                GfLogLevel            : Read / Write

The level of log entries to display.

Default value: Verbose


The "ts-format" property

  "ts-format"            gchararray            : Read / Write

The format string for timestamps.

Default value: "%X"


The "ts-visible" property

  "ts-visible"           gboolean              : Read / Write

Whether or not to show timestamps.

Default value: TRUE