Kaydet (Commit) aeb09298 authored tarafından Gürer Özen's avatar Gürer Özen

daha informatif debug çıktısı

üst 32fc1163
/*
** Copyright (c) 2005, TUBITAK/UEKAE
** Copyright (c) 2005-2006, TUBITAK/UEKAE
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
......@@ -11,11 +11,13 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#include "cfg.h"
#include "log.h"
#include "process.h"
static void
timestamp(FILE *f)
......@@ -30,11 +32,22 @@ timestamp(FILE *f)
fputs(buf, f);
}
static void
pidstamp(FILE *f)
{
if (strlen(my_proc.desc) <= 5)
fprintf(f, "(%s-%d) ", my_proc.desc, getpid());
else
fprintf(f, "(%s-%d) ", my_proc.desc + 5, getpid());
}
static void
log_print(const char *fmt, va_list ap, int error)
{
if (cfg_log_console)
if (cfg_log_console) {
pidstamp(stdout);
vprintf(fmt, ap);
}
if (cfg_log_file) {
FILE *f;
......@@ -42,6 +55,7 @@ log_print(const char *fmt, va_list ap, int error)
f = fopen(cfg_log_file_name, "a");
if (f) {
timestamp(f);
pidstamp(f);
if (error) fprintf(f, "Error: ");
vfprintf(f, fmt, ap);
fclose(f);
......
/*
** Copyright (c) 2005, TUBITAK/UEKAE
** Copyright (c) 2005-2006, TUBITAK/UEKAE
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
......@@ -77,6 +77,7 @@ main(int argc, char *argv[])
puts(_("This program is a system service and should not started by users."));
exit(1);
}
proc_init();
log_start();
// Shutdown old COMAR
......@@ -85,7 +86,6 @@ main(int argc, char *argv[])
// Second phase: subsytem init
if (db_init() != 0) return 1;
proc_init();
if (model_init() != 0) return 1;
// Third phase: helper processes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment