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 /**@file 00023 * 00024 * Control log messages that are not associated with a transport. 00025 * See pn_transport_trace for transport-related logging. 00026 */ 00027 00028 #include <proton/import_export.h> 00029 #include <proton/type_compat.h> 00030 00031 /** Callback for customized logging. */ 00032 typedef void (*pn_logger_t)(const char *message); 00033 00034 /** Enable/disable global logging. 00035 * 00036 * By default, logging is enabled by envionment variable PN_TRACE_LOG. 00037 * Calling this function overrides the environment setting. 00038 */ 00039 PN_EXTERN void pn_log_enable(bool enabled); 00040 00041 /** Set the logger. 00042 * 00043 * By default a logger that prints to stderr is installed. 00044 * 00045 * @param logger is called with each log messsage if logging is enabled. 00046 * Passing 0 disables logging regardless of pn_log_enable() or environment settings. 00047 */ 00048 PN_EXTERN void pn_log_logger(pn_logger_t logger); 00049 00050 #endif