gsstest: fixed compilation errors
[tridge/bind9.git] / contrib / zkt / log.h
1 /*****************************************************************
2 **
3 **      @(#) log.h  (c) June 2008  Holger Zuleger  hznet.de
4 **
5 **      Copyright (c) June 2008, Holger Zuleger HZnet. All rights reserved.
6 **
7 **      This software is open source.
8 **
9 **      Redistribution and use in source and binary forms, with or without
10 **      modification, are permitted provided that the following conditions
11 **      are met:
12 **
13 **      Redistributions of source code must retain the above copyright notice,
14 **      this list of conditions and the following disclaimer.
15 **
16 **      Redistributions in binary form must reproduce the above copyright notice,
17 **      this list of conditions and the following disclaimer in the documentation
18 **      and/or other materials provided with the distribution.
19 **
20 **      Neither the name of Holger Zuleger HZnet nor the names of its contributors may
21 **      be used to endorse or promote products derived from this software without
22 **      specific prior written permission.
23 **
24 **      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 **      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 **      TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 **      PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
28 **      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 **      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 **      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 **      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 **      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 **      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 **      POSSIBILITY OF SUCH DAMAGE.
35 **
36 *****************************************************************/
37 #ifndef LOG_H
38 # define LOG_H
39 # include <sys/types.h>
40 # include <stdarg.h>
41 # include <stdio.h>
42 # include <time.h>
43 # include <syslog.h>
44
45 #ifndef LOG_FNAMETMPL
46 # define        LOG_FNAMETMPL   "/zkt-%04d-%02d-%02dT%02d%02d%02dZ+log"
47 #endif
48
49 #ifndef LOG_DOMAINTMPL
50 # define        LOG_DOMAINTMPL  "zktlog-%s"
51 #endif
52
53
54 typedef enum {
55         LG_NONE = 0,
56         LG_DEBUG,
57         LG_INFO,
58         LG_NOTICE,
59         LG_WARNING,
60         LG_ERROR,
61         LG_FATAL
62 } lg_lvl_t;
63
64 extern  lg_lvl_t        lg_str2lvl (const char *name);
65 extern  int     lg_str2syslog (const char *facility);
66 extern  const   char    *lg_lvl2str (lg_lvl_t level);
67 extern  lg_lvl_t        lg_lvl2syslog (lg_lvl_t level);
68 extern  long    lg_geterrcnt (void);
69 extern  long    lg_seterrcnt (long value);
70 extern  long    lg_reseterrcnt (void);
71 extern  int     lg_open (const char *progname, const char *facility, const char *syslevel, const char *path, const char *file, const char *filelevel);
72 extern  int     lg_close (void);
73 extern  int     lg_zone_start (const char *dir, const char *domain);
74 extern  int     lg_zone_end (void);
75 extern  void    lg_args (lg_lvl_t level, int argc, char * const argv[]);
76 extern  void    lg_mesg (int level, char *fmt, ...);
77 #endif