open-vm-tools 9.10.2
|
#include "vmtoolsInt.h"
#include <stdio.h>
#include <stdlib.h>
#include <glib/gstdio.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/time.h>
#include "glibUtils.h"
#include "log.h"
#include "str.h"
#include "system.h"
Macros | |
#define | LOGGING_GROUP "logging" |
#define | MAX_DOMAIN_LEN 64 |
#define | DEFAULT_HANDLER "syslog" |
#define | SAFE_HANDLER "std" |
#define | IS_FATAL(level) ((level) & G_LOG_FLAG_FATAL) |
#define | SHOULD_LOG(level, data) |
#define | CLEAR_LOG_HANDLER(handler) |
Typedefs | |
typedef struct LogHandler | LogHandler |
Functions | |
gint | VMToolsAsprintf (gchar **string, gchar const *format,...) |
void | VMTools_ConfigLogging (const gchar *defaultDomain, GKeyFile *cfg, gboolean force, gboolean reset) |
void | VMTools_StopLogging (void) |
void | VMTools_RestartLogging (void) |
void | VMTools_SetGuestSDKMode (void) |
void | Debug (const char *fmt,...) |
void | Log (const char *fmt,...) |
void | LogV (uint32 routing, const char *fmt, va_list args) |
void | Panic (const char *fmt,...) |
void | Warning (const char *fmt,...) |
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 CLEAR_LOG_HANDLER | ( | handler | ) |
Clean up the contents of a log handler.
#define DEFAULT_HANDLER "syslog" |
The default handler to use if none is specified by the config data.
#define IS_FATAL | ( | level | ) | ((level) & G_LOG_FLAG_FATAL) |
Tells whether the given log level is a fatal error.
#define SAFE_HANDLER "std" |
The "failsafe" handler.
#define SHOULD_LOG | ( | level, | |
data | |||
) |
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.
void Debug | ( | const char * | fmt, |
... | |||
) |
Logs a message using the G_LOG_LEVEL_DEBUG level.
[in] | fmt | Log message format. |
void Log | ( | const char * | fmt, |
... | |||
) |
Logs a message using the G_LOG_LEVEL_INFO level.
[in] | fmt | Log message format. |
void LogV | ( | uint32 | routing, |
const char * | fmt, | ||
va_list | args | ||
) |
Logs a message with the given log level.
Translates lib/log levels into glib levels, and sends the message to the log implementation.
[in] | level | Log level. |
[in] | fmt | Log message format. |
[in] | args | Log message arguments. |
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.
[in] | fmt | Log message format. |
gint VMToolsAsprintf | ( | gchar ** | string, |
gchar const * | format, | ||
... | |||
) |
glib-based version of Str_Asprintf().
[out] | string | Where to store the result. |
[in] | format | String format. |
[in] | ... | String arguments. |
void Warning | ( | const char * | fmt, |
... | |||
) |
Logs a message using the G_LOG_LEVEL_WARNING level.
[in] | fmt | Log message format. |