1 // -*- C -*- 2 /** 3 * Module: Log4CPLUS 4 * File: clogger.h 5 * Created: 01/2011 6 * Author: Jens Rehsack 7 * 8 * 9 * Copyright 2011 Jens Rehsack & Tad E. Smith 10 * 11 * Licensed under the Apache License, Version 2.0 (the "License"); 12 * you may not use this file except in compliance with the License. 13 * You may obtain a copy of the License at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, software 18 * distributed under the License is distributed on an "AS IS" BASIS, 19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 * See the License for the specific language governing permissions and 21 * limitations under the License. 22 */ 23 24 /** @file 25 * This header defines the C API for log4cplus and the logging macros. */ 26 27 #ifndef DCMTK_LOG4CPLUS_CLOGGERHEADER_ 28 #define DCMTK_LOG4CPLUS_CLOGGERHEADER_ 29 30 #include "dcmtk/oflog/config.h" 31 32 #if defined (DCMTK_LOG4CPLUS_HAVE_PRAGMA_ONCE) 33 #pragma once 34 #endif 35 36 37 #ifdef __cplusplus 38 extern "C" 39 { 40 #endif 41 42 // TODO UNICDE capable 43 44 typedef void *logger_t; 45 typedef int loglevel_t; 46 47 #define L4CP_OFF_LOG_LEVEL 60000 48 #define L4CP_FATAL_LOG_LEVEL 50000 49 #define L4CP_ERROR_LOG_LEVEL 40000 50 #define L4CP_WARN_LOG_LEVEL 30000 51 #define L4CP_INFO_LOG_LEVEL 20000 52 #define L4CP_DEBUG_LOG_LEVEL 10000 53 #define L4CP_TRACE_LOG_LEVEL 0 54 #define L4CP_ALL_LOG_LEVEL TRACE_LOG_LEVEL 55 #define L4CP_NOT_SET_LOG_LEVEL -1 56 57 #ifdef DCMTK_OFLOG_UNICODE 58 # define DCMTK_LOG4CPLUS_TEXT2(STRING) L##STRING 59 typedef wchar_t log4cplus_char_t; 60 #else 61 # define DCMTK_LOG4CPLUS_TEXT2(STRING) STRING 62 typedef char log4cplus_char_t; 63 #endif // DCMTK_OFLOG_UNICODE 64 #define DCMTK_LOG4CPLUS_TEXT(STRING) DCMTK_LOG4CPLUS_TEXT2(STRING) 65 66 DCMTK_LOG4CPLUS_EXPORT int log4cplus_file_configure(const log4cplus_char_t *pathname); 67 DCMTK_LOG4CPLUS_EXPORT int log4cplus_str_configure(const log4cplus_char_t *config); 68 DCMTK_LOG4CPLUS_EXPORT int log4cplus_basic_configure(void); 69 DCMTK_LOG4CPLUS_EXPORT void log4cplus_shutdown(void); 70 71 DCMTK_LOG4CPLUS_EXPORT int log4cplus_logger_exists(const log4cplus_char_t *name); 72 DCMTK_LOG4CPLUS_EXPORT int log4cplus_logger_is_enabled_for( 73 const log4cplus_char_t *name, loglevel_t ll); 74 DCMTK_LOG4CPLUS_EXPORT int log4cplus_logger_log(const log4cplus_char_t *name, 75 loglevel_t ll, const log4cplus_char_t *msgfmt, ...) 76 DCMTK_LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4); 77 DCMTK_LOG4CPLUS_EXPORT int log4cplus_logger_force_log(const log4cplus_char_t *name, 78 loglevel_t ll, const log4cplus_char_t *msgfmt, ...) 79 DCMTK_LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4); 80 81 #ifdef __cplusplus 82 } 83 #endif 84 85 #endif /*?DCMTK_LOG4CPLUS_CLOGGERHEADER_*/ 86