sprint 1-alpha
|
00001 /****************************************************************************** 00002 * SPRINT::log 00003 * 00004 * Copyright (C) 2003-2011 Paolo Medici <www.pmx.it> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 * 00020 *******************************************************************************/ 00021 00022 #ifndef _SPRINT_LOG_H 00023 #define _SPRINT_LOG_H 00024 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00037 #define LOG_LEVEL_CUSTOM ('$') 00038 #define LOG_LEVEL_INFO (':') 00039 #define LOG_LEVEL_COMMENT ('#') 00040 #define LOG_LEVEL_DESC ('.') 00041 #define LOG_LEVEL_WARNING ('W') 00042 #define LOG_LEVEL_ERROR ('E') 00043 #define LOG_LEVEL_SYSTEM ('!') 00044 #define LOG_LEVEL_TIME ('@') 00045 00047 00048 #ifdef DISABLE_LOG 00049 00050 #define logBegin(a,b,c); {} 00051 #define logDone(); {} 00052 #define logPuts(level, string); {} 00053 #define logPutsf(...); {} 00054 #define logPuttime(); {} 00055 #define logPutRaw(data,data_len); {} 00056 #define logPrintSocketError(lpszModuleName); {} 00057 00058 #else 00059 00065 int logBegin(const char *logfile, const char *log_proc_name, int append); 00067 void logDone(); 00068 00070 void logPuts(char uLevel, const char *string); 00072 void logPutsf(char uLevel, const char *format, ...); 00074 void logPuttime(); 00076 void logPrintSocketError(const char* lpszModuleName); 00078 void logPutRaw(const void *data, unsigned long data_len); 00080 void logHexDump(const void *data, unsigned long data_len, int flag); 00081 00083 int LogParseErrorEx(const char* lpszArg, unsigned int dwParm); 00084 00086 extern bool log_send_to_console; 00087 00089 /*** 00090 * log_verbose = 0 OUTPUT SOLO DEGLI ERRORI 00091 * log_verbose = 1 OUTPUT SOLO DEGLI ERRORI e dei WARNING 00092 * log_verbose = 2 OUTPUT anche degli INFO 00093 * LOG_LEVEL_COMMENT viene scritto solo se log_verbose>=2 */ 00094 extern int log_verbose; 00095 00096 #define ANCHOR(name) logPuts(LOG_LEVEL_INFO, #name); 00097 00098 #endif 00099 00100 #ifdef __cplusplus 00101 } 00102 #endif 00103 00104 #endif