libpynq
(release 5EWC0-2023 version 0.2.1 of 2023-09-01 11:02)
Loading...
Searching...
No Matches
log.c
Go to the documentation of this file.
1
#include <
log.h
>
2
#include <stdarg.h>
3
#include <stdbool.h>
4
#include <stdio.h>
5
#include <stdlib.h>
6
#include <string.h>
7
8
static
LogLevel
critical_level =
LOG_LEVEL_ERROR
;
9
static
LogLevel
min_log_level =
LOG_LEVEL_WARNING
;
10
11
void
pynq_log
(
const
LogLevel
level,
char
const
*domain,
char
const
*location,
12
unsigned
int
lineno,
char
const
*fmt, ...){
13
va_list arg_list;
14
if
(level < min_log_level) {
15
return
;
16
}
17
va_start(arg_list, fmt);
18
vfprintf(stderr, fmt, arg_list);
19
va_end(arg_list);
20
if
(fmt[strlen(fmt) - 1] !=
'\n'
) {
21
fputs(
"\n"
, stderr);
22
}
23
if
(level >= critical_level) {
24
abort();
25
}
26
}
pynq_log
void pynq_log(const LogLevel level, char const *domain, char const *location, unsigned int lineno, char const *fmt,...)
Definition
log.c:11
LogLevel
LogLevel
Definition
log.h:65
LOG_LEVEL_ERROR
@ LOG_LEVEL_ERROR
Definition
log.h:71
LOG_LEVEL_WARNING
@ LOG_LEVEL_WARNING
Definition
log.h:69
log.h
library
empty-library
log.c
Generated on Fri Sep 1 2023 11:02:39 for libpynq by
1.9.7