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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/* Logging definitions used in log.h and log_local.h
* Copyright (C) 2011 Chris Hall (GMCH), Highwayman
*
* This file is part of GNU Zebra.
*
* GNU Zebra 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; either version 2, or (at your option) any
* later version.
*
* GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _ZEBRA_LOG_COMMON_H
#define _ZEBRA_LOG_COMMON_H
#include "misc.h"
#include <syslog.h>
#include "qfstring.h"
/*==============================================================================
* This is for things which are required in log.h for external use, and in
* log_local.h for use within the log/command/vty family.
*/
/*------------------------------------------------------------------------------
* The protocols known to the logging system.
*/
typedef enum
{
ZLOG_NONE,
ZLOG_DEFAULT,
ZLOG_ZEBRA,
ZLOG_RIP,
ZLOG_BGP,
ZLOG_OSPF,
ZLOG_RIPNG,
ZLOG_OSPF6,
ZLOG_ISIS,
ZLOG_MASC
} zlog_proto_t;
/*------------------------------------------------------------------------------
* If maxlvl is set to ZLOG_DISABLED, then no messages will be sent
* to that logging destination.
*
* Note that logging levels with higher priority have lower numbers. So, this
* may (well) be -ve.
*/
enum { ZLOG_DISABLED = LOG_EMERG - 1 } ;
/*------------------------------------------------------------------------------
* The logging destinations supported.
*/
typedef enum
{
ZLOG_DEST_SYSLOG = 0,
ZLOG_DEST_FILE,
ZLOG_DEST_STDOUT,
ZLOG_DEST_MONITOR,
ZLOG_DEST_COUNT /* Number of destinations */
} zlog_dest_t;
/*------------------------------------------------------------------------------
*
*/
struct zlog ;
/*------------------------------------------------------------------------------
* Getting a timestamp, in the form:
*/
#define TIMESTAMP_FORM "%Y/%m/%d %H:%M:%S"
/*
* This has a fixed length (leading zeros are included) of 19 characters
* (unless this code is still in use beyond the year 9999 !)
*
* Which may be followed by "." and a number of decimal digits, usually 1..6.
*
* So the maximum time stamp is 19 + 1 + 6 = 26. Adding the trailing '\n', and
* rounding up for good measure...
*/
enum { timestamp_buffer_len = 30 } ;
QFB_T(timestamp_buffer_len) timestamp_str_t ;
extern timestamp_str_t quagga_timestamp(int timestamp_precision) ;
#endif /* _ZEBRA_LOG_COMMON_H */
|