osmo-sdr/firmware/src/logging.c @ master
1 | d5c4d1ed | Harald Welte | |
---|---|---|---|
2 | /* (C) 2011-2012 by Harald Welte <laforge@gnumonks.org>
|
||
3 | *
|
||
4 | * All Rights Reserved
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or modify
|
||
7 | * it under the terms of the GNU General Public License as published by
|
||
8 | * the Free Software Foundation; either version 3 of the License, or
|
||
9 | * (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
18 | */
|
||
19 | |||
20 | 406fd679 | Harald Welte | #include <stdint.h>
|
21 | #include <stdio.h>
|
||
22 | #include <unistd.h>
|
||
23 | #include <stdlib.h>
|
||
24 | #include <errno.h>
|
||
25 | #include <string.h>
|
||
26 | #include <stdarg.h>
|
||
27 | |||
28 | |||
29 | void logp2(int subsys, unsigned int level, char *file, |
||
30 | int line, int cont, const char *format, ...) |
||
31 | {
|
||
32 | va_list ap; |
||
33 | printf("%u/%u/%s:%u: ", subsys, level, file, line); |
||
34 | |||
35 | va_start(ap, format); |
||
36 | vfprintf(stderr, format, ap); |
||
37 | va_end(ap); |
||
38 | 741335fe | Harald Welte | fputc('\r', stderr); |
39 | 406fd679 | Harald Welte | }
|