00001 #ifndef LOG_H 00002 #define LOG_H 00003 /* 00004 * Licensed to the Apache Software Foundation (ASF) under one 00005 * or more contributor license agreements. See the NOTICE file 00006 * distributed with this work for additional information 00007 * regarding copyright ownership. The ASF licenses this file 00008 * to you under the Apache License, Version 2.0 (the 00009 * "License"); you may not use this file except in compliance 00010 * with the License. You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, 00015 * software distributed under the License is distributed on an 00016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00017 * KIND, either express or implied. See the License for the 00018 * specific language governing permissions and limitations 00019 * under the License. 00020 */ 00021 00022 #include <proton/import_export.h> 00023 #include <proton/type_compat.h> 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 /**@file 00030 * 00031 * Control log messages that are not associated with a transport. 00032 * See pn_transport_trace for transport-related logging. 00033 */ 00034 00035 /** Callback for customized logging. */ 00036 typedef void (*pn_logger_t)(const char *message); 00037 00038 /** Enable/disable global logging. 00039 * 00040 * By default, logging is enabled by envionment variable PN_TRACE_LOG. 00041 * Calling this function overrides the environment setting. 00042 */ 00043 PN_EXTERN void pn_log_enable(bool enabled); 00044 00045 /** Set the logger. 00046 * 00047 * By default a logger that prints to stderr is installed. 00048 * 00049 * @param logger is called with each log messsage if logging is enabled. 00050 * Passing 0 disables logging regardless of pn_log_enable() or environment settings. 00051 */ 00052 PN_EXTERN void pn_log_logger(pn_logger_t logger); 00053 00054 #ifdef __cplusplus 00055 } 00056 #endif 00057 00058 #endif