![]() |
![]() |
![]() |
libinfinoted-plugin-manager-0.6 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <infinoted/infinoted-log.h> InfinotedLog; struct InfinotedLogClass; InfinotedLog * infinoted_log_new (void
); gboolean infinoted_log_open (InfinotedLog *log
,const gchar *path
,GError **error
); void infinoted_log_close (InfinotedLog *log
); void infinoted_log_log (InfinotedLog *log
,guint prio
,const char *fmt
,...
); void infinoted_log_info (InfinotedLog *log
,const char *fmt
,...
); void infinoted_log_warning (InfinotedLog *log
,const char *fmt
,...
); void infinoted_log_error (InfinotedLog *log
,const char *fmt
,...
);
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.
typedef struct _InfinotedLog 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.
Default signal handler for the "log-message" signal. |
InfinotedLog * infinoted_log_new (void
);
Creates a new InfinotedLog.
Returns : |
A new InfinotedLog. Free with g_object_unref() when no longer
needed. |
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.
|
A InfinotedLog. |
|
The path to the log file to write, or NULL . |
|
Location to store error information, if any, or NULL . |
Returns : |
TRUE on success, or FALSE otherwise. |
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.
|
A InfinotedLog. |
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.
|
A InfinotedLog. |
|
Priority of the logged message. |
|
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.
|
A InfinotedLog. |
|
A printf-style format string. |
|
Format arguments. |
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.
|
A InfinotedLog. |
|
A printf-style format string. |
|
Format arguments. |
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.
|
A InfinotedLog. |
|
A printf-style format string. |
|
Format arguments. |
"log-message"
signalvoid user_function (InfinotedLog *log,
guint prio,
guint depth,
gchar *text,
gpointer user_data) : Run First
This signal is emitted when a new line of log message is written to the log.
|
The InfinotedLog that is logging a message. |
|
The priority of the logged message. |
|
The recursion depth of the logged message. |
|
The logged message text. |
|
user data set when the signal handler was connected. |