A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Insist on not letting solaris try to print NULL since this leads this poor soul to...
[simgrid.git]
/
src
/
xbt
/
log_default_appender.c
diff --git
a/src/xbt/log_default_appender.c
b/src/xbt/log_default_appender.c
index
931e689
..
1bac48d
100644
(file)
--- a/
src/xbt/log_default_appender.c
+++ b/
src/xbt/log_default_appender.c
@@
-2,59
+2,62
@@
/* file_appender - a dumb log appender which simply prints to stdout */
/* file_appender - a dumb log appender which simply prints to stdout */
-/* Authors: Martin Quinson */
-/* Copyright (C) 2003, 2004 Martin Quinson. */
+/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/* This program is free software; you can redistribute it and/or modify it
-
under the terms of the license (GNU LGPL) which comes with this package. */
+
*
under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "xbt/error.h"
#include <stdio.h>
#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "xbt/error.h"
#include <stdio.h>
-
GRAS
_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler");
+
XBT
_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler");
/**
* The root category's default logging function.
*/
/**
* The root category's default logging function.
*/
-extern const char *
gras
_log_priority_names[7];
+extern const char *
xbt
_log_priority_names[7];
-static void append_file(
gras_log_appender_t* this, gras_log_event_t*
ev,
+static void append_file(
xbt_log_appender_t this, xbt_log_event_t
ev,
const char *fmt);
/*
const char *fmt);
/*
-struct
gras
_log_appender_file_s {
-
gras
_log_appender_t* appender;
+struct
xbt
_log_appender_file_s {
+
xbt
_log_appender_t* appender;
FILE *file;
};
*/
FILE *file;
};
*/
-static
gras_log_appender_t gras
_log_appender_file = { append_file, NULL } ;
+static
s_xbt_log_appender_t xbt
_log_appender_file = { append_file, NULL } ;
/* appender_data=FILE* */
/* appender_data=FILE* */
-
gras_log_appender_t* gras_log_default_appender = &gras
_log_appender_file;
+
xbt_log_appender_t xbt_log_default_appender = &xbt
_log_appender_file;
-static void append_file(
gras_log_appender_t* this,
-
gras_log_event_t*
ev,
+static void append_file(
xbt_log_appender_t this,
+
xbt_log_event_t
ev,
const char *fmt) {
/* TODO: define a format field in struct for timestamp, etc.
struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;*/
const char *fmt) {
/* TODO: define a format field in struct for timestamp, etc.
struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;*/
-
+
+ char *procname = (char*)xbt_procname();
+ if (!procname)
+ procname = (char*)"";
+
if ((FILE*)(this->appender_data) == NULL)
this->appender_data = (void*)stderr;
if ((FILE*)(this->appender_data) == NULL)
this->appender_data = (void*)stderr;
-
gras
_assert0(ev->priority>=0,
+
xbt
_assert0(ev->priority>=0,
"Negative logging priority naturally forbidden");
"Negative logging priority naturally forbidden");
-
gras_assert1(ev->priority<sizeof(gras
_log_priority_names),
+
xbt_assert1(ev->priority<sizeof(xbt
_log_priority_names),
"Priority %d is greater than the biggest allowed value",
ev->priority);
"Priority %d is greater than the biggest allowed value",
ev->priority);
- fprintf(stderr, "
%s:%d: "
, ev->fileName, ev->lineNum);
+ fprintf(stderr, "
[%s] %s:%d: ", procname
, ev->fileName, ev->lineNum);
fprintf(stderr, "[%s/%s] ",
fprintf(stderr, "[%s/%s] ",
- ev->cat->name,
gras_log_priority_names[ev->priority]
);
+ ev->cat->name,
xbt_log_priority_names[ev->priority]
);
vfprintf(stderr, fmt, ev->ap);
fprintf(stderr, "\n");
}
vfprintf(stderr, fmt, ev->ap);
fprintf(stderr, "\n");
}