1 |
zoff99 |
2 |
/**
|
2 |
|
|
* Navit, a modular navigation system.
|
3 |
|
|
* Copyright (C) 2005-2008 Navit Team
|
4 |
|
|
*
|
5 |
|
|
* This program is free software; you can redistribute it and/or
|
6 |
|
|
* modify it under the terms of the GNU Library General Public License
|
7 |
|
|
* version 2 as published by the Free Software Foundation.
|
8 |
|
|
*
|
9 |
|
|
* This program is distributed in the hope that it will be useful,
|
10 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
* GNU Library General Public License for more details.
|
13 |
|
|
*
|
14 |
|
|
* You should have received a copy of the GNU Library General Public
|
15 |
|
|
* License along with this program; if not, write to the
|
16 |
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
17 |
|
|
* Boston, MA 02110-1301, USA.
|
18 |
|
|
*/
|
19 |
|
|
|
20 |
|
|
#ifndef NAVIT_LOG_H
|
21 |
|
|
#define NAVIT_LOG_H
|
22 |
|
|
#define LOG_BUFFER_SIZE 256
|
23 |
|
|
/**
|
24 |
|
|
* printf-style writing to the log file. A buffer of LOG_BUFFER_SIZE
|
25 |
|
|
* bytes is preallocated for the complete format message, longer
|
26 |
|
|
* messages will be truncated.
|
27 |
|
|
*/
|
28 |
|
|
|
29 |
|
|
enum log_flags {
|
30 |
|
|
log_flag_replace_buffer=1,
|
31 |
|
|
log_flag_force_flush=2,
|
32 |
|
|
log_flag_keep_pointer=4,
|
33 |
|
|
log_flag_keep_buffer=8,
|
34 |
|
|
log_flag_truncate=16,
|
35 |
|
|
};
|
36 |
|
|
/* prototypes */
|
37 |
|
|
enum attr_type;
|
38 |
|
|
enum log_flags;
|
39 |
|
|
struct attr;
|
40 |
|
|
struct attr_iter;
|
41 |
|
|
struct log;
|
42 |
|
|
int log_get_attr(struct log *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
|
43 |
|
|
struct log *log_new(struct attr *parent, struct attr **attrs);
|
44 |
|
|
void log_set_header(struct log *this_, char *data, int len);
|
45 |
|
|
void log_set_trailer(struct log *this_, char *data, int len);
|
46 |
|
|
void log_write(struct log *this_, char *data, int len, enum log_flags flags);
|
47 |
|
|
void *log_get_buffer(struct log *this_, int *len);
|
48 |
|
|
void log_printf(struct log *this_, char *fmt, ...);
|
49 |
|
|
void log_destroy(struct log *this_);
|
50 |
|
|
/* end of prototypes */
|
51 |
|
|
#endif
|