libvmtools/vmtoolsLog.c File Reference
#include "vmware/tools/utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <glib/gstdio.h>
#include <unistd.h>
#include "codeset.h"
#include "file.h"
#include "hostinfo.h"
#include "system.h"
Defines |
#define | DEFAULT_HANDLER VMToolsLogFile |
#define | LOGGING_GROUP "logging" |
#define | MAX_DOMAIN_LEN 64 |
#define | IS_FATAL(level) ((level) & G_LOG_FLAG_FATAL) |
#define | SHOULD_LOG(level, data) |
#define | CLEAR_LOG_HANDLER(handler) |
Functions |
void | VMTools_ConfigLogging (const gchar *defaultDomain, GKeyFile *cfg, gboolean force, gboolean reset) |
void | Debug (const char *fmt,...) |
void | Log (const char *fmt,...) |
void | Panic (const char *fmt,...) |
void | Warning (const char *fmt,...) |
Detailed Description
Defines a logging infrastructure for the vmtools library based on glib's logging facilities. Wrap the commonly used logging functions (Log/Warning/Debug), and provides configurability for where logs should go to.
To choose the logging domain for your source file, define G_LOG_DOMAIN before including glib.h.
Define Documentation
#define CLEAR_LOG_HANDLER |
( |
handler |
|
) |
|
Value:do { \
if ((handler)->file != NULL) { \
fclose((handler)->file); \
} \
g_free((handler)->path); \
g_free((handler)->domain); \
} while (0)
Clean up the contents of a log handler.
#define IS_FATAL |
( |
level |
|
) |
((level) & G_LOG_FLAG_FATAL) |
Tells whether the given log level is a fatal error.
#define SHOULD_LOG |
( |
level, |
|
|
data |
|
) |
|
Value:(IS_FATAL(level) || \
(gLogEnabled && ((data)->mask & (level))))
Tells whether a message should be logged. All fatal messages are logged, regardless of what the configuration says. Otherwise, the log domain's configuration is respected.
Function Documentation
void Debug |
( |
const char * |
fmt, |
|
|
|
... | |
|
) |
| | |
Logs a message using the G_LOG_LEVEL_DEBUG level.
- Parameters:
-
[in] | fmt | Log message format. |
void Log |
( |
const char * |
fmt, |
|
|
|
... | |
|
) |
| | |
Logs a message using the G_LOG_LEVEL_MESSAGE level.
- Parameters:
-
[in] | fmt | Log message format. |
void Panic |
( |
const char * |
fmt, |
|
|
|
... | |
|
) |
| | |
Logs a message using the G_LOG_LEVEL_ERROR level. In the default configuration, this will cause the application to terminate and, if enabled, to dump core.
- Parameters:
-
[in] | fmt | Log message format. |
void Warning |
( |
const char * |
fmt, |
|
|
|
... | |
|
) |
| | |
Logs a message using the G_LOG_LEVEL_WARNING level.
- Parameters:
-
[in] | fmt | Log message format. |