Airframe Application Utilities
libairframe 0.7.2 API documentation

Main Page | Data Structures | File List | Data Fields | Globals

logconfig.h File Reference

Airframe Logging Configuration Support. More...

#include <airframe/autoinc.h>
#include <airframe/airopt.h>

Go to the source code of this file.


Defines

#define LOGC_ERROR_DOMAIN   (g_quark_from_string("airframeLogError"))
 GError domain for logconfig errors.
#define LOGC_ERROR_ARGUMENT   1
 Logconfig argument error.

Functions

gboolean logc_add_option_group (AirOptionCtx *aoctx, const char *appname, const char *version)
 Add an option group for logging configuration to the given option context.
gboolean logc_setup (GError **err)
 Set up log routing.

Detailed Description

Airframe Logging Configuration Support.

Supplies glib log routing to standard error, file output, and the UNIX syslog facility, and the command line option processing necessary to use it. Integrates with daeconfig to ensure proper use of standard error, and to default to standard error or syslog as appropriate. Use this when your application uses glib logging and you want to give your users control over where to route logging information via the command line.


Define Documentation

#define LOGC_ERROR_ARGUMENT   1
 

Logconfig argument error.

The user passed in an illegal command-line argument.


Function Documentation

gboolean logc_add_option_group AirOptionCtx aoctx,
const char *  appname,
const char *  version
 

Add an option group for logging configuration to the given option context.

This option group defines four options: --log (-l) to specify a logging destination, --loglevel (-L) to specify the minimum severity of logged messages, --verbose (-v) which is a shortcut for --loglevel debug, and --version (-V) which will print version information and exit the application.

Parameters:
aoctx airframe option context
appname application name to display
version application version string
Returns:
TRUE if successful, FALSE otherwise

gboolean logc_setup GError **  err  ) 
 

Set up log routing.

Call this after parsing an options context including a GOptionGroup returned from logc_option_group(). This sets up log routing using logconfig; subsequent glib logging calls will be routed as specified by the user.

By default, if the application will fork to the background logging is routed to standard error; otherwise, it is routed to the "user" syslog facility. In either case, the default loglevel is warning.

Parameters:
err an error description
Returns:
TRUE on success, FALSE otherwise.