forked from Qihoo360/Atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchassis-log.h
More file actions
75 lines (56 loc) · 2.21 KB
/
chassis-log.h
File metadata and controls
75 lines (56 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* $%BEGINLICENSE%$
Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; version 2 of the
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
$%ENDLICENSE%$ */
#ifndef _CHASSIS_LOG_H_
#define _CHASSIS_LOG_H_
#include <glib.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include "chassis-exports.h"
#define CHASSIS_RESOLUTION_SEC 0x0
#define CHASSIS_RESOLUTION_MS 0x1
#define CHASSIS_RESOLUTION_DEFAULT CHASSIS_RESOLUTION_SEC
/** @addtogroup chassis */
/*@{*/
typedef struct {
GLogLevelFlags min_lvl;
gchar *log_filename;
gint log_file_fd;
gboolean use_syslog;
#ifdef _WIN32
HANDLE event_source_handle;
gboolean use_windows_applog;
#endif
gboolean rotate_logs;
GString *log_ts_str;
gint log_ts_resolution; /*<< timestamp resolution (sec, ms) */
GString *last_msg;
time_t last_msg_ts;
guint last_msg_count;
} chassis_log;
CHASSIS_API chassis_log *chassis_log_init(void) G_GNUC_DEPRECATED;
CHASSIS_API chassis_log *chassis_log_new(void);
CHASSIS_API int chassis_log_set_level(chassis_log *log, const gchar *level);
CHASSIS_API void chassis_log_free(chassis_log *log);
CHASSIS_API int chassis_log_open(chassis_log *log);
CHASSIS_API void chassis_log_func(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data);
CHASSIS_API void chassis_log_set_logrotate(chassis_log *log);
CHASSIS_API int chassis_log_set_event_log(chassis_log *log, const char *app_name);
CHASSIS_API const char *chassis_log_skip_topsrcdir(const char *message);
CHASSIS_API void chassis_set_logtimestamp_resolution(chassis_log *log, int res);
CHASSIS_API int chassis_get_logtimestamp_resolution(chassis_log *log);
/*@}*/
#endif