1
/*************************
2
* libdicom by Tony Voet *
3
*************************/
5
* $Id: log.c,v 1.2 2002/11/06 23:31:16 enlf Exp $
14
CONDITION dicom_log_level=NOTICE;
16
/* eNlf: BEGIN -- change for compilation error on Red Hat 6.0 */
17
/* static FILE *stream=stderr; */
18
/* The above statement fails: initializer not constant */
19
/* eNlf: END -- change for compilation error on Red Hat 6.0 */
20
static FILE *stream=NULL;
21
static char *program=NULL;
27
void dicom_log_name(char *name)
29
program=strrchr(name,'/');
41
int dicom_log_open(const char *file)
45
dicom_log(ERROR,"No file given");
49
stream=fopen(file,"a");
54
dicom_log(ERROR,"Unable to open log file");
65
void dicom_log(CONDITION condition,const char *message)
70
static char *explination[]=
82
if (condition>dicom_log_level)
86
strftime(tmp,32,"%b %d %H:%M:%S",localtime(&t));
88
/* eNlf: BEGIN -- change for compilation error on Red Hat 6.0 */
90
fprintf(stderr,"%s %s[%u]: %s: %s\n",
92
program ? program : "log",
93
(unsigned int) getpid(),
94
explination[condition],
97
fprintf(stream,"%s %s[%u]: %s: %s\n",
99
program ? program : "log",
100
(unsigned int) getpid(),
101
explination[condition],
104
/* eNlf: END -- change for compilation error on Red Hat 6.0 */
111
int dicom_log_close(void)
115
dicom_log(NOTICE,"Attempt to close stderr");
122
dicom_log(WARNING,"Unable to close log");