GXimMessages

GXimMessages — Logging facility class

Synopsis

                    GXimMessages;
struct              GXimMessagesClass;
enum                GXimMessagesType;
#define             LIBGXIM_INTERFACE_DBUS
#define             LIBGXIM_PATH_DBUS
#define             LIBGXIM_SERVICE_DBUS
#define             g_xim_message                       (_i_,
                                                         _f_,
                                                         ...)
void                g_xim_messages_activate             (GXimMessages *message,
                                                         gboolean flag);
#define             g_xim_messages_bug                  (_i_,
                                                         ...)
void                g_xim_messages_clear_filter         (GXimMessages *message);
#define             g_xim_messages_critical             (_i_,
                                                         ...)
#define             g_xim_messages_debug                (_i_,
                                                         _f_,
                                                         ...)
void                g_xim_messages_enable_filter        (GXimMessages *message,
                                                         const gchar *filter_name);
#define             g_xim_messages_error                (_i_,
                                                         ...)
#define             g_xim_messages_gerror               (_i_,
                                                         _e_)
#define             g_xim_messages_info                 (_i_,
                                                         _f_,
                                                         ...)
GXimMessages *      g_xim_messages_new                  (void);
void                g_xim_messages_printf               (GXimMessages *message,
                                                         const gchar *filter,
                                                         GXimMessagesType type,
                                                         const gchar *format,
                                                         ...);
void                g_xim_messages_set_filename         (GXimMessages *message,
                                                         const gchar *filename);
void                g_xim_messages_vprintf              (GXimMessages *message,
                                                         const gchar *filter,
                                                         GXimMessagesType type,
                                                         const gchar *format,
                                                         va_list args);
#define             g_xim_messages_warning              (_i_,
                                                         ...)

Object Hierarchy

  GObject
   +----GXimMessages

Properties

  "all-filters"              gboolean              : Read / Write
  "master"                   gboolean              : Read / Write

Signals

  "activated"                                      : Run Last
  "created"                                        : Run First
  "filename-changed"                               : Run Last
  "filter-added"                                   : Run Last
  "filter-cleared"                                 : Run Last

Description

GXimMessages provides a logging facility. this allows you to output messages any time you want. you can manage it with DBus as well. so you don't even restart processes to do something with this then.

DBus signals

Right now the following signals are available to manage the logging facility. you can emits signals any time as following:

1
$ dbus-send --session --type=signal /org/tagoh/libgxim org.tagoh.libgxim.<em class="replaceable"><code>SignalName</code></em> type:<em class="replaceable"><code>value</code></em>

SignalName will be replaced with following signal names. See manpage for dbus-send to learn usage for others.

Activate

Sets the activity of the logging facility. a boolean value is required as a parameter. See g_xim_messages_activate() for more details.

SetFilename

Sets the filename to be logged messages into. a string value is required as a parameter. See g_xim_messages_set_filename() for more details.

RemoveAllFilters

Resets filters to output. See g_xim_messages_clear_filter() for more details.

AddFilter

Adds a filter which you want to see a message. a string value is required as a parameter. See g_xim_messages_enable_filter() for more details.

Details

GXimMessages

typedef struct _GXimMessages GXimMessages;

An implementation of message handler class


struct GXimMessagesClass

struct GXimMessagesClass {
	GObjectClass  parent_class;
};


enum GXimMessagesType

typedef enum {
	G_XIM_MESSAGES_MESSAGE,
	G_XIM_MESSAGES_DEBUG,
	G_XIM_MESSAGES_INFO,
	G_XIM_MESSAGES_WARNING,
	G_XIM_MESSAGES_ERROR,
	G_XIM_MESSAGES_CRITICAL,
	G_XIM_MESSAGES_BUG
} GXimMessagesType;

Flags specifying the type of messages.

G_XIM_MESSAGES_MESSAGE

a message type for usual messages, see g_xim_message().

G_XIM_MESSAGES_DEBUG

a message type for debug, see g_xim_messages_debug().

G_XIM_MESSAGES_INFO

a message type for information, see g_xim_messages_info().

G_XIM_MESSAGES_WARNING

a message type for warnings, see g_xim_messages_warning().

G_XIM_MESSAGES_ERROR

a message type for errors, see g_xim_messages_error().

G_XIM_MESSAGES_CRITICAL

a message type for critical errors, see g_xim_messages_critical().

G_XIM_MESSAGES_BUG

a message type for bugs, see g_xim_messages_bug().

LIBGXIM_INTERFACE_DBUS

#define LIBGXIM_INTERFACE_DBUS		"org.tagoh.libgxim"

An interface name for libgxim used in DBus.


LIBGXIM_PATH_DBUS

#define LIBGXIM_PATH_DBUS		"/org/tagoh/libgxim"

A path name for libgxim used in DBus.


LIBGXIM_SERVICE_DBUS

#define LIBGXIM_SERVICE_DBUS		"org.tagoh.libgxim"

A service name for libgxim used in DBus.


g_xim_message()

#define             g_xim_message(_i_,_f_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_MESSAGE.

_i_ :

a GXimMessages.

_f_ :

a unique filter name.

... :

arguments include the format string

g_xim_messages_activate ()

void                g_xim_messages_activate             (GXimMessages *message,
                                                         gboolean flag);

Sets the activity of the logging facility.

This affects all of the instance of GXimMessages in the process.

message :

a GXimMessages.

flag :

TRUE to enable logging. FALSE to disable logging.

g_xim_messages_bug()

#define             g_xim_messages_bug(_i_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_BUG.

_i_ :

a GXimMessages.

... :

arguments include the format string.

g_xim_messages_clear_filter ()

void                g_xim_messages_clear_filter         (GXimMessages *message);

Resets all of the filters you wanted to allow a message.

This affects all of the instance of GXimMessages in the process.

message :

a GXimMessages.

g_xim_messages_critical()

#define             g_xim_messages_critical(_i_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_CRITICAL.

_i_ :

a GXimMessages.

... :

arguments include the format string.

g_xim_messages_debug()

#define             g_xim_messages_debug(_i_,_f_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_DEBUG.

_i_ :

a GXimMessages.

_f_ :

a unique filter name.

... :

arguments include the format string.

g_xim_messages_enable_filter ()

void                g_xim_messages_enable_filter        (GXimMessages *message,
                                                         const gchar *filter_name);

Allows logging a message categorized to filter_name. "all" and "noall" filter name is reserved. "all" to enable all of filters no matter what filters are enabled. "noall" to enable filters specified by this function.

This affects all of the instance of GXimMessages in the process.

message :

a GXimMessages.

filter_name :

a unique filter name to be categorized.

g_xim_messages_error()

#define             g_xim_messages_error(_i_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_ERROR.

_i_ :

a GXimMessages.

... :

arguments include the format string.

g_xim_messages_gerror()

#define             g_xim_messages_gerror(_i_,_e_)

Outputs a GError with g_xim_messages_printf().

This is a convenience macro to output a message. the message type depends on the error code which would be logically added with GXimErrorType.

_i_ :

a GXimMessages.

_e_ :

a GError to output.

g_xim_messages_info()

#define             g_xim_messages_info(_i_,_f_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_INFO.

_i_ :

a GXimMessages.

_f_ :

a unique filter name.

... :

arguments include the format string.

g_xim_messages_new ()

GXimMessages *      g_xim_messages_new                  (void);

Creates an instance to provide you a logging facility. when an instance is created, GXimMessages::created signal will be emitted.

Returns :

a GXimMessages.

g_xim_messages_printf ()

void                g_xim_messages_printf               (GXimMessages *message,
                                                         const gchar *filter,
                                                         GXimMessagesType type,
                                                         const gchar *format,
                                                         ...);

Outputs a message. when G_XIM_MESSAGES_WARNING, G_XIM_MESSAGES_ERROR, G_XIM_MESSAGES_CRITICAL or G_XIM_MESSAGES_BUG is specified to type, a message will be output regardless of what filter is given to filter. Otherwise if filter isn't enabled, this just will be ignored.

message :

a GXimMessages.

filter :

a unique filter name to be categorized.

type :

an urgency of the message.

format :

the message format. See the printf() documentation.

... :

arguments to format.

g_xim_messages_set_filename ()

void                g_xim_messages_set_filename         (GXimMessages *message,
                                                         const gchar *filename);

Sets the filename.

This affects all of the instance of GXimMessages in the process.

message :

a GXimMessages.

filename :

the filename to be logged a message into.

g_xim_messages_vprintf ()

void                g_xim_messages_vprintf              (GXimMessages *message,
                                                         const gchar *filter,
                                                         GXimMessagesType type,
                                                         const gchar *format,
                                                         va_list args);

Outputs a message. when G_XIM_MESSAGES_WARNING, G_XIM_MESSAGES_ERROR, G_XIM_MESSAGES_CRITICAL or G_XIM_MESSAGES_BUG is specified to type, a message will be output regardless of what filter is given to filter. Otherwise if filter isn't enabled, this just will be ignored.

message :

a GXimMessages.

filter :

a unique filter name to be categorized.

type :

an urgency of the message.

format :

the message format. See the printf() documentation.

args :

a va_list.

g_xim_messages_warning()

#define             g_xim_messages_warning(_i_,...)

Outputs a message with g_xim_messages_printf().

This is a convenience macro to output a message with G_XIM_MESSAGES_WARNING.

_i_ :

a GXimMessages.

... :

arguments include the format string.

Property Details

The "all-filters" property

  "all-filters"              gboolean              : Read / Write

TRUE to enable all of the messages filters. FALSE to deal with each filters added by "filter-added" signal.

Default value: FALSE


The "master" property

  "master"                   gboolean              : Read / Write

TRUE to be a master instance of GXimMessages. FALSE to be a slave instance of GXimMessages.

Default value: FALSE

Signal Details

The "activated" signal

gboolean            user_function                      (GXimMessages *message,
                                                        gboolean      flag,
                                                        gpointer      user_data)      : Run Last

The ::activated signal will be emitted when someone calls g_xim_messages_activate() or when someone emits Activate signal through DBus.

message :

the object which received the signal.

flag :

TRUE to enable the logging facility.

user_data :

user data set when the signal handler was connected.

Returns :

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

The "created" signal

void                user_function                      (GXimMessages *message,
                                                        GXimMessages *created_object,
                                                        gpointer      user_data)           : Run First

The ::created signal will be emitted when an instance of GXimMessages is created. the master object only receives this signal.

message :

the object which received the signal.

created_object :

a GXimMessages which newly created somewhere in the process.

user_data :

user data set when the signal handler was connected.

The "filename-changed" signal

gboolean            user_function                      (GXimMessages *message,
                                                        gchar        *filename,
                                                        gpointer      user_data)      : Run Last

The ::filename-changed signal will be emitted when someone calls g_xim_messages_set_filename() or when someone emits SetFilename signal through DBus.

message :

the object which received the signal.

filename :

a filename to be logged into.

user_data :

user data set when the signal handler was connected.

Returns :

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

The "filter-added" signal

gboolean            user_function                      (GXimMessages *message,
                                                        gchar        *filter,
                                                        gpointer      user_data)      : Run Last

The ::filter-added signal will be emitted when someone calls g_xim_messages_enable_filter() or when someone emits AddFilter signal through DBus.

message :

the object which received the signal.

filter :

the filter name to enable logging.

user_data :

user data set when the signal handler was connected.

Returns :

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

The "filter-cleared" signal

gboolean            user_function                      (GXimMessages *message,
                                                        gpointer      user_data)      : Run Last

The ::filter-cleared signal will be emitted when someone calls g_xim_messages_clear_filter() or when someone emits RemoveAllFilters signal through DBus.

message :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

Returns :

TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.