GXimMessage

GXimMessage — Logging facility class

Synopsis




#define             g_xim_message_gerror                (_i_,_e_)
#define             g_xim_message                       (_i_,_f_,...)
#define             g_xim_message_info                  (_i_,_f_,...)
#define             g_xim_message_warning               (_i_,...)
#define             g_xim_message_error                 (_i_,...)
#define             g_xim_message_critical              (_i_,...)
#define             g_xim_message_debug                 (_i_,_f_,...)
#define             g_xim_message_bug                   (_i_,...)
enum                GXimMessageType;
                    GXimMessage;
GXimMessage*        g_xim_message_new                   (void);
void                g_xim_message_activate              (GXimMessage *message,
                                                         gboolean flag);
void                g_xim_message_set_filename          (GXimMessage *message,
                                                         const gchar *filename);
void                g_xim_message_clear_filter          (GXimMessage *message);
void                g_xim_message_enable_filter         (GXimMessage *message,
                                                         const gchar *filter_name);
void                g_xim_message_vprintf               (GXimMessage *message,
                                                         const gchar *filter,
                                                         GXimMessageType type,
                                                         const gchar *format,
                                                         va_list args);
void                g_xim_message_printf                (GXimMessage *message,
                                                         const gchar *filter,
                                                         GXimMessageType type,
                                                         const gchar *format,
                                                         ...);

Object Hierarchy


  GObject
   +----GXimMessage

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

GXimMessage 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 then.

DBus signals

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

Example 1. 

$ dbus-send --session --type=signal /org/tagoh/libgxim org.tagoh.libgxim.SignalName type:value
  

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_message_activate() for more details.

SetFilename

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

RemoveAllFilters

Resets filters to output. See g_xim_message_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_message_enable_filter() for more details.

Details

g_xim_message_gerror()

#define             g_xim_message_gerror(_i_,_e_)

Outputs a GError with g_xim_message_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 GXimMessage.

_e_ :

a GError to output.

g_xim_message()

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

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

_f_ :

a unique filter name.

... :


g_xim_message_info()

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

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

_f_ :

a unique filter name.

... :


g_xim_message_warning()

#define             g_xim_message_warning(_i_,...)

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

... :


g_xim_message_error()

#define             g_xim_message_error(_i_,...)

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

... :


g_xim_message_critical()

#define             g_xim_message_critical(_i_,...)

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

... :


g_xim_message_debug()

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

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

_f_ :

a unique filter name.

... :


g_xim_message_bug()

#define             g_xim_message_bug(_i_,...)

Outputs a message with g_xim_message_printf().

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

_i_ :

a GXimMessage.

... :


enum GXimMessageType

typedef enum {
	G_XIM_MESSAGE_MESSAGE,
	G_XIM_MESSAGE_DEBUG,
	G_XIM_MESSAGE_INFO,
	G_XIM_MESSAGE_WARNING,
	G_XIM_MESSAGE_ERROR,
	G_XIM_MESSAGE_CRITICAL,
	G_XIM_MESSAGE_BUG
} GXimMessageType;

Flags specifying the type of messages.

G_XIM_MESSAGE_MESSAGE

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

G_XIM_MESSAGE_DEBUG

a message type for debug, see g_xim_message_debug().

G_XIM_MESSAGE_INFO

a message type for information, see g_xim_message_info().

G_XIM_MESSAGE_WARNING

a message type for warnings, see g_xim_message_warning().

G_XIM_MESSAGE_ERROR

a message type for errors, see g_xim_message_error().

G_XIM_MESSAGE_CRITICAL

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

G_XIM_MESSAGE_BUG

a message type for bugs, see g_xim_message_bug().

GXimMessage

typedef struct _GXimMessage GXimMessage;

An implementation of message handler class


g_xim_message_new ()

GXimMessage*        g_xim_message_new                   (void);

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

Returns :

a GXimMessage.

g_xim_message_activate ()

void                g_xim_message_activate              (GXimMessage *message,
                                                         gboolean flag);

Sets the activity of the logging facility.

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

message :

a GXimMessage.

flag :

TRUE to enable logging. FALSE to disable logging.

g_xim_message_set_filename ()

void                g_xim_message_set_filename          (GXimMessage *message,
                                                         const gchar *filename);

Sets the filename.

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

message :

a GXimMessage.

filename :

the filename to be logged a message into.

g_xim_message_clear_filter ()

void                g_xim_message_clear_filter          (GXimMessage *message);

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

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

message :

a GXimMessage.

g_xim_message_enable_filter ()

void                g_xim_message_enable_filter         (GXimMessage *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 GXimMessage in the process.

message :

a GXimMessage.

filter_name :

a unique filter name to be categorized.

g_xim_message_vprintf ()

void                g_xim_message_vprintf               (GXimMessage *message,
                                                         const gchar *filter,
                                                         GXimMessageType type,
                                                         const gchar *format,
                                                         va_list args);

Outputs a message. when G_XIM_MESSAGE_WARNING, G_XIM_MESSAGE_ERROR, G_XIM_MESSAGE_CRITICAL or G_XIM_MESSAGE_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 GXimMessage.

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_message_printf ()

void                g_xim_message_printf                (GXimMessage *message,
                                                         const gchar *filter,
                                                         GXimMessageType type,
                                                         const gchar *format,
                                                         ...);

Outputs a message. when G_XIM_MESSAGE_WARNING, G_XIM_MESSAGE_ERROR, G_XIM_MESSAGE_CRITICAL or G_XIM_MESSAGE_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 GXimMessage.

filter :

a unique filter name to be categorized.

type :

an urgency of the message.

format :

the message format. See the printf() documentation.

... :

Property Details

The "all-filters" property

  "all-filters"              gboolean              : Read / Write

TRUE to enable all of the message 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 GXimMessage. FALSE to be a slave instance of GXimMessage.

Default value: FALSE

Signal Details

The "activated" signal

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

The ::activated signal will be emitted when someone calls g_xim_message_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                      (GXimMessage *message,
                                                        GXimMessage *created_object,
                                                        gpointer     user_data)           : Run First

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

message :

the object which received the signal.

created_object :

a GXimMessage 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                      (GXimMessage *message,
                                                        gchar       *filename,
                                                        gpointer     user_data)      : Run Last

The ::filename-changed signal will be emitted when someone calls g_xim_message_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                      (GXimMessage *message,
                                                        gchar       *filter,
                                                        gpointer     user_data)      : Run Last

The ::filter-added signal will be emitted when someone calls g_xim_message_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                      (GXimMessage *message,
                                                        gpointer     user_data)      : Run Last

The ::filter-cleared signal will be emitted when someone calls g_xim_message_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.