proton/logger.h

Go to the documentation of this file.
00001 #ifndef LOGGER_H
00002 #define LOGGER_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 
00031 #include <proton/import_export.h>
00032 #include <proton/object.h>
00033 
00034 #include <stdarg.h>
00035 #include <stdint.h>
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00086 typedef struct pn_logger_t pn_logger_t;
00087 
00093 typedef enum pn_log_subsystem_t {
00094     PN_SUBSYSTEM_NONE    = 0,    
00095     PN_SUBSYSTEM_MEMORY  = 1,    
00096     PN_SUBSYSTEM_IO      = 2,    
00097     PN_SUBSYSTEM_EVENT   = 4,    
00098     PN_SUBSYSTEM_AMQP    = 8,    
00099     PN_SUBSYSTEM_SSL     = 16,   
00100     PN_SUBSYSTEM_SASL    = 32,   
00101     PN_SUBSYSTEM_BINDING = 64,   
00102     PN_SUBSYSTEM_ALL     = 65535 
00103 } pn_log_subsystem_t; /* We hint to the compiler it can use 16 bits for this value */
00104 
00110 typedef enum pn_log_level_t {
00111     PN_LEVEL_NONE     = 0,    
00112     PN_LEVEL_CRITICAL = 1,    
00113     PN_LEVEL_ERROR    = 2,    
00114     PN_LEVEL_WARNING  = 4,    
00115     PN_LEVEL_INFO     = 8,    
00116     PN_LEVEL_DEBUG    = 16,   
00117     PN_LEVEL_TRACE    = 32,   
00118     PN_LEVEL_FRAME    = 64,   
00119     PN_LEVEL_RAW      = 128,  
00120     PN_LEVEL_ALL      = 65535 
00121 } pn_log_level_t; /* We hint to the compiler that it can use 16 bits for this value */
00122 
00126 typedef void (*pn_log_sink_t)(intptr_t sink_context, pn_log_subsystem_t subsystem, pn_log_level_t severity, const char *message);
00127 
00133 PN_EXTERN pn_logger_t *pn_default_logger(void);
00134 
00141 PN_EXTERN const char *pn_logger_level_name(pn_log_level_t level);
00142 
00149 PN_EXTERN const char *pn_logger_subsystem_name(pn_log_subsystem_t subsystem);
00150 
00171 PN_EXTERN void pn_logger_set_mask(pn_logger_t *logger, uint16_t subsystem, uint16_t level);
00172 
00193 PN_EXTERN void pn_logger_reset_mask(pn_logger_t *logger, uint16_t subsystem, uint16_t severity);
00194 
00206 PN_EXTERN void pn_logger_set_log_sink(pn_logger_t *logger, pn_log_sink_t sink, intptr_t sink_context);
00207 
00214 PN_EXTERN pn_log_sink_t pn_logger_get_log_sink(pn_logger_t *logger);
00215 
00222 PN_EXTERN intptr_t pn_logger_get_log_sink_context(pn_logger_t *logger);
00223 
00233 PN_EXTERN void pn_logger_logf(pn_logger_t *logger, pn_log_subsystem_t subsystem, pn_log_level_t severity, const char *fmt, ...);
00234 
00235 #ifdef __cplusplus
00236 }
00237 #endif
00238 
00243 #endif

Generated on 30 Jul 2020 for Qpid Proton C by  doxygen 1.6.1