logging

logging — Program message log

Functions

Types and Values

Includes

#include <libgwyapp/gwyapp.h>

Description

Functions

gwy_app_setup_logging()

void
gwy_app_setup_logging (GwyAppLoggingFlags flags);

Sets up Gwyddion GLib log handler.

The log handler sends the messages to a log file or console, as Gwyddion usually does. This function may not be useful in Gwyddion-based programs unless they try to emulate Gwyddion behaviour closely.

The function should only be called only once, early in the program initialisation. It is not possible to modify the setup once logging is already in progress. No warning is printed if you call it repeatedly with exactly the same flags , but it should not be done anyway.

Parameters

flags

Flags controlling how messages are handled.

 

gwy_app_set_log_messages()

void
gwy_app_set_log_messages (const gchar *domain,
                          GLogLevelFlags log_levels,
                          gboolean setting);

Sets basic handling of log messages.

Gwyddion treats log messages in one of two ways. Either it prints them to the console and/or a log file, according to the command line options, environment variables and OS defaults. Or it discards them. By default, unimportant third party messages are discarded. Meaning, for instance, that using gwy_debug() outside of Gwyddion itself does not do anything useful.

This function allows you to change the default handling and either display messages which are normally discarded or suppress messages which are normally logged.

Parameters

domain

Log message domain (empty for the default application domain).

 

log_levels

Log levels to apply the setting to (a combination of log level flags).

 

setting

TRUE to log messages as given levesl, FALSE to discard them.

 

gwy_app_get_log_text_buffer()

GtkTextBuffer *
gwy_app_get_log_text_buffer (void);

Obtains a text buffer with program log messages.

This functions may only be called after gwy_app_setup_logging() and, obviously, after GTK+ was intialised.

The text buffer is owned by the library and must not be modified nor destroyed. It will be already filled with messages occurring between gwy_app_setup_logging() and this function call. New messages will be appended to the buffer as they arrive.

Returns

Text buffer with the program log messages.

Types and Values

enum GwyAppLoggingFlags

Flags controlling where program messages are written.

Members

GWY_APP_LOGGING_TO_FILE

Messages go to a log file, either gwyddion.log or given by environment variable GWYDDION_LOGFILE.

 

GWY_APP_LOGGING_TO_CONSOLE

Messages go to standard output and standard error depending on message type (emulating where GLib sends them).