1 /* 2 SMS Server Tools 3 3 Copyright (C) 2006- Keijo Kasvi 4 http://smstools3.kekekasvi.com/ 5 6 Based on SMS Server Tools 2, http://stefanfrings.de/smstools/ 7 SMS Server Tools version 2 and below are Copyright (C) Stefan Frings. 8 9 This program is free software unless you got it under another license directly 10 from the author. You can redistribute it and/or modify it under the terms of 11 the GNU General Public License as published by the Free Software Foundation. 12 Either version 2 of the License, or (at your option) any later version. 13 */ 14 15 #ifndef LOGGING_H 16 #define LOGGING_H 17 18 #include <time.h> 19 20 // 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c: 21 char logch_buffer[8192]; 22 23 #ifdef __GNUC__ 24 void logch(char* format, ...) __attribute__ ((format(printf, 1, 2))); 25 #else 26 void logch(char* format, ...); 27 #endif 28 29 char prch(char ch); 30 31 // 3.1.16beta: changed type: 32 //int trouble_logging_started; 33 time_t trouble_logging_started; 34 35 int change_loglevel(int new_level); 36 void restore_loglevel(); 37 int get_loglevel(); 38 39 int openlogfile(char *filename, int facility, int level); 40 41 // if filename if 0, "" or "syslog": opens syslog. Level is ignored. 42 // else: opens a log file. Facility is not used. Level specifies the verbosity (9=highest). 43 // If the filename is a number it is interpreted as the file handle and 44 // duplicated. The file must be already open. 45 // Returns the file handle to the log file. 46 47 48 void closelogfile(); 49 void writelogfile0(int severity, int trouble, char *text); 50 51 #ifdef __GNUC__ 52 void writelogfile(int severity, int trouble, char* format, ...) __attribute__ ((format(printf, 3, 4))); 53 #else 54 void writelogfile(int severity, int trouble, char* format, ...); 55 #endif 56 57 void flush_smart_logging(); 58 59 #endif 60