Top | ![]() |
![]() |
![]() |
![]() |
InfinotedLog * | infinoted_log_new () |
gboolean | infinoted_log_open () |
void | infinoted_log_close () |
void | infinoted_log_log () |
void | infinoted_log_info () |
void | infinoted_log_warning () |
void | infinoted_log_error () |
InfinotedLog manages a message log. Messages can be written to the log either as informational, warning and error messages. If the log was successfully opened, also a glib logging handler is installed which redirects glib logging to this class. Log output is always shown on stderr and, optionally, can be duplicated to a file as well.
InfinotedLog *
infinoted_log_new (void
);
Creates a new InfinotedLog.
[constructor]
gboolean infinoted_log_open (InfinotedLog *log
,const gchar *path
,GError **error
);
Attempts to open the log file at the given path. If the log file could not
be opened the function returns FALSE
and error
is set. If the log file
exists already then new log messages will be appended.
If path
is NULL
no log file is opened and logging only occurs to stderr.
log |
A InfinotedLog. |
|
path |
The path to the log file to write,
or |
[type filename][allow-none] |
error |
Location to store error information, if any, or |
void
infinoted_log_close (InfinotedLog *log
);
Closes a InfinotedLog object opened with infinoted_log_open()
. After the
log was closed it can be opened again with a different file. The log is
closed automatically on destruction.
void infinoted_log_log (InfinotedLog *log
,guint prio
,const char *fmt
,...
);
Logs a message with the given priority. The priority is one of LOG_ERR
,
LOG_WARNING
or LOG_INFO
. If the server is daemonized, log to syslog,
otherwise log to stderr. If a logfile is given in the options when log
was created, the logfile is written to as well.
log |
A InfinotedLog. |
|
prio |
Priority of the logged message. |
|
fmt |
A printf-style format string. |
|
... |
Format arguments. |
void infinoted_log_info (InfinotedLog *log
,const char *fmt
,...
);
Logs an info message. If the server is daemonized, log to syslog,
otherwise log to stderr. If a logfile is given in the options when log
was created, the logfile is written to as well.
void infinoted_log_warning (InfinotedLog *log
,const char *fmt
,...
);
Logs a warning message. If the server is daemonized, log to syslog,
otherwise log to stderr. If a logfile is given in the options when log
was created, the logfile is written to as well.
void infinoted_log_error (InfinotedLog *log
,const char *fmt
,...
);
Logs an error message. If the server is daemonized, log to syslog,
otherwise log to stderr. If a logfile is given in the options when log
was created, the logfile is written to as well.
struct InfinotedLog;
InfinotedLog is an opaque data type. You should only access it via the public API functions.
struct InfinotedLogClass { void (*log_message)(InfinotedLog* log, guint prio, guint depth, const gchar* text); };
This structure contains default signal handlers for InfinotedLog.
“log-message”
signalvoid user_function (InfinotedLog *log, guint prio, guint depth, char *text, gpointer user_data)
This signal is emitted when a new line of log message is written to the log.
log |
The InfinotedLog that is logging a message. |
|
prio |
The priority of the logged message. |
|
depth |
The recursion depth of the logged message. |
|
text |
The logged message text. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First