/usr/include/kannel/gwlib/log.h is in kannel-dev 1.4.4-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /* ====================================================================
* The Kannel Software License, Version 1.0
*
* Copyright (c) 2001-2014 Kannel Group
* Copyright (c) 1998-2001 WapIT Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Kannel Group (http://www.kannel.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Kannel" and "Kannel Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please
* contact org@kannel.org.
*
* 5. Products derived from this software may not be called "Kannel",
* nor may "Kannel" appear in their name, without prior written
* permission of the Kannel Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Kannel Group. For more information on
* the Kannel Group, please see <http://www.kannel.org/>.
*
* Portions of this software are based upon software originally written at
* WapIT Ltd., Helsinki, Finland for the Kannel project.
*/
/*
* log.h - logging functions
*
* Please note that opening and closing of log files are not thread safe.
* Don't do it unless you're in single-thread mode.
*/
#ifndef GWLOG_H
#define GWLOG_H
/* Symbolic levels for output levels. */
enum output_level {
GW_DEBUG, GW_INFO, GW_WARNING, GW_ERROR, GW_PANIC, GW_BACKTRACE
};
/* defines if a log-file is exclusive or not */
enum excl_state {
GW_NON_EXCL, GW_EXCL
};
/* Initialize the log file module */
void log_init(void);
/* Shutdown the log file module */
void log_shutdown(void);
/* Print a panicky error message and terminate the program with a failure.
* So, this function is called when there is no other choice than to exit
* immediately, with given reason
*/
#define panic gw_panic
void gw_panic(int, const char *, ...) PRINTFLIKE(2,3);
/*
* Print given stacktrace. If no stackstrace given then stacktrace will be
* initialized
*/
void gw_backtrace(void **, size_t, int);
/* Print a normal error message. Used when something which should be
* investigated and possibly fixed, happens. The error might be fatal, too,
* but we have time to put system down peacefully.
*/
void error(int, const char *, ...) PRINTFLIKE(2,3);
/* Print a warning message. 'Warning' is a message that should be told and
* distinguished from normal information (info), but does not necessary
* require any further investigations. Like 'warning, no sender number set'
*/
void warning(int, const char *, ...) PRINTFLIKE(2,3);
/* Print an informational message. This information should be limited to
* one or two rows per request, if real debugging information is needed,
* use debug
*/
void info(int, const char *, ...) PRINTFLIKE(2,3);
/*
* Print a debug message. Most of the log messages should be of this level
* when the system is under development. The first argument gives the `place'
* where the function is called from; see function set_debug_places.
*/
void debug(const char *, int, const char *, ...) PRINTFLIKE(3,4);
/*
* Set the places from which debug messages are actually printed. This
* allows run-time configuration of what is and is not logged when debug
* is called. `places' is a string of tokens, separated by whitespace and/or
* commas, with trailing asterisks (`*') matching anything. For instance,
* if `places' is "wap.wsp.* wap.wtp.* wapbox", then all places that begin
* with "wap.wsp." or "wap.wtp." (including the dots) are logged, and so
* is the place called "wapbox". Nothing else is logged at debug level,
* however. The 'places' string can also have negations, marked with '-' at
* the start, so that nothing in that place is outputted. So if the string is
* "wap.wsp.* -wap.wap.http", only wap.wsp is logged, but not http-parts on
* it
*/
void log_set_debug_places(const char *places);
/* Set minimum level for output messages to stderr. Messages with a lower
level are not printed to standard error, but may be printed to files
(see below). */
void log_set_output_level(enum output_level level);
/* Set minimum level for output messages to logfiles */
void log_set_log_level(enum output_level level);
/*
* Set the syslog facility to use.
*/
void log_set_syslog_facility(char *facility);
/*
* Set syslog usage. If `ident' is NULL, syslog is not used.
*/
void log_set_syslog(const char *ident, int syslog_level);
/* Start logging to a file as well. The file will get messages at least of
level `level'. There is no need and no way to close the log file;
it will be closed automatically when the program finishes. Failures
when opening to the log file are printed to stderr.
Where `excl' defines if the log file will be exclusive or not.
Returns the index within the global logfiles[] array where this
log file entry has been added. */
int log_open(char *filename, int level, enum excl_state excl);
/* Close and re-open all logfiles */
void log_reopen(void);
/*
* Close all log files.
*/
void log_close_all(void);
/*
* Register a thread to a specific logfiles[] index and hence
* to a specific exclusive log file.
*/
void log_thread_to(unsigned int idx);
#endif
|