1 /* Licensed to the Apache Software Foundation (ASF) under one or more 2 * contributor license agreements. See the NOTICE file distributed with 3 * this work for additional information regarding copyright ownership. 4 * The ASF licenses this file to You under the Apache License, Version 2.0 5 * (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __JSVC_DEBUG_H__ 18 #define __JSVC_DEBUG_H__ 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 /** 24 * Wether debugging is enabled or not. 25 */ 26 extern bool log_debug_flag; 27 28 /* Wether SYSLOG logging (for stderr) is enable or not. */ 29 extern bool log_stderr_syslog_flag; 30 31 /* Wether SYSLOG logging (for stdout) is enable or not. */ 32 extern bool log_stdout_syslog_flag; 33 34 /** 35 * The name of the jsvc binary. 36 */ 37 extern char *log_prog; 38 39 /** 40 * Helper macro to avoid NPEs in printf. 41 */ 42 #define PRINT_NULL(x) ((x) == NULL ? "null" : (x)) 43 44 /** 45 * Dump a debug message. 46 * 47 * @param fmt The printf style message format. 48 * @param ... Any optional parameter for the message. 49 */ 50 void log_debug(const char *fmt, ...); 51 52 /** 53 * Dump an error message. 54 * 55 * @param fmt The printf style message format. 56 * @param ... Any optional parameter for the message. 57 */ 58 void log_error(const char *fmt, ...); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 #endif /* ifndef __JSVC_DEBUG_H__ */ 64 65