1 /*
2  *
3   ***** BEGIN LICENSE BLOCK *****
4 
5   Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
6 
7   This file is part of CLIXON.
8 
9   Licensed under the Apache License, Version 2.0 (the "License");
10   you may not use this file except in compliance with the License.
11   You may obtain a copy of the License at
12 
13     http://www.apache.org/licenses/LICENSE-2.0
14 
15   Unless required by applicable law or agreed to in writing, software
16   distributed under the License is distributed on an "AS IS" BASIS,
17   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   See the License for the specific language governing permissions and
19   limitations under the License.
20 
21   Alternatively, the contents of this file may be used under the terms of
22   the GNU General Public License Version 3 or later (the "GPL"),
23   in which case the provisions of the GPL are applicable instead
24   of those above. If you wish to allow use of your version of this file only
25   under the terms of the GPL, and not to allow others to
26   use your version of this file under the terms of Apache License version 2,
27   indicate your decision by deleting the provisions above and replace them with
28   the  notice and other provisions required by the GPL. If you do not delete
29   the provisions above, a recipient may use your version of this file under
30   the terms of any one of the Apache License version 2 or the GPL.
31 
32   ***** END LICENSE BLOCK *****
33 
34  *
35  * Regular logging and debugging. Syslog using levels.
36  */
37 
38 #ifndef _CLIXON_LOG_H_
39 #define _CLIXON_LOG_H_
40 
41 /*
42  * Constants
43  */
44 #define CLICON_LOG_SYSLOG 1 /* print logs on syslog */
45 #define CLICON_LOG_STDERR 2 /* print logs on stderr */
46 #define CLICON_LOG_STDOUT 4 /* print logs on stdout */
47 #define CLICON_LOG_FILE   8 /* print logs on clicon_log_filename */
48 
49 /*
50  * Prototypes
51  */
52 int clicon_log_init(char *ident, int upto, int flags);
53 int clicon_log_exit(void);
54 int clicon_log_opt(char c);
55 int clicon_log_file(char *filename);
56 int clicon_get_logflags(void);
57 #if defined(__GNUC__) && __GNUC__ >= 3
58 int clicon_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
59 int clicon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
60 #else
61 int clicon_log(int level, const char *format, ...);
62 int clicon_debug(int dbglevel, const char *format, ...);
63 #endif
64 int clicon_debug_init(int dbglevel, FILE *f);
65 int clicon_debug_get(void);
66 
67 char *mon2name(int md);
68 
69 #endif  /* _CLIXON_LOG_H_ */
70