Logs that come before logging system intialization spam the
console output. Therefore, we make the logging a no-op for
non-fatal messages until logging system has been initialized.
Usually, we initialize the logging system when process starts up,
so we will swallow only those non-fatal log messages that are
generated during very early stages of process initialization.
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
static LogHandler *gDefaultData;
static LogHandler *gErrorData;
static GPtrArray *gDomains = NULL;
+static gboolean gLogInitialized = FALSE;
/* Internal functions. */
}
gLogEnabled |= force;
+ gLogInitialized = TRUE;
if (allocDict) {
g_key_file_free(cfg);
const char *fmt,
va_list args)
{
+ if (!gLogInitialized && !IS_FATAL(level)) {
+ /*
+ * Avoid logging without initialization because
+ * it leads to spamming of the console output.
+ * Fatal messages are exception.
+ */
+ return;
+ }
+
if (gPanicCount == 0) {
char *msg = Str_Vasprintf(NULL, fmt, args);
if (msg != NULL) {