Qpid Proton C API  0.32.0
logger.h
Go to the documentation of this file.
1 #ifndef LOGGER_H
2 #define LOGGER_H
3 /*
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements. See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership. The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License. You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied. See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  */
21 
31 #include <proton/import_export.h>
32 #include <proton/object.h>
33 
34 #include <stdarg.h>
35 #include <stdint.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
86 typedef struct pn_logger_t pn_logger_t;
87 
93 typedef enum pn_log_subsystem_t {
103 } pn_log_subsystem_t; /* We hint to the compiler it can use 16 bits for this value */
104 
110 typedef enum pn_log_level_t {
119  PN_LEVEL_RAW = 128,
120  PN_LEVEL_ALL = 65535
121 } pn_log_level_t; /* We hint to the compiler that it can use 16 bits for this value */
122 
126 typedef void (*pn_log_sink_t)(intptr_t sink_context, pn_log_subsystem_t subsystem, pn_log_level_t severity, const char *message);
127 
133 PN_EXTERN pn_logger_t *pn_default_logger(void);
134 
141 PN_EXTERN const char *pn_logger_level_name(pn_log_level_t level);
142 
149 PN_EXTERN const char *pn_logger_subsystem_name(pn_log_subsystem_t subsystem);
150 
171 PN_EXTERN void pn_logger_set_mask(pn_logger_t *logger, uint16_t subsystem, uint16_t level);
172 
193 PN_EXTERN void pn_logger_reset_mask(pn_logger_t *logger, uint16_t subsystem, uint16_t level);
194 
206 PN_EXTERN void pn_logger_set_log_sink(pn_logger_t *logger, pn_log_sink_t sink, intptr_t sink_context);
207 
215 
222 PN_EXTERN intptr_t pn_logger_get_log_sink_context(pn_logger_t *logger);
223 
235 PN_EXTERN void pn_logger_logf(pn_logger_t *logger, pn_log_subsystem_t subsystem, pn_log_level_t level, const char *fmt, ...);
236 
237 #ifdef __cplusplus
238 }
239 #endif
240 
245 #endif
const char * pn_logger_level_name(pn_log_level_t level)
Get a human readable name for a logger severity.
struct pn_logger_t pn_logger_t
The logger object allows library logging to be controlled.
Definition: logger.h:86
Memory usage.
Definition: logger.h:95
void pn_logger_reset_mask(pn_logger_t *logger, uint16_t subsystem, uint16_t level)
Clear a logger&#39;s tracing flags.
void pn_logger_logf(pn_logger_t *logger, pn_log_subsystem_t subsystem, pn_log_level_t level, const char *fmt,...)
Log a printf formatted message using the logger.
pn_log_level_t
Definitions for different severities of log messages Note that these are exclusive bits so that you c...
Definition: logger.h:110
pn_logger_t * pn_default_logger(void)
Return the default library logger.
void pn_logger_set_mask(pn_logger_t *logger, uint16_t subsystem, uint16_t level)
Set a logger&#39;s tracing flags.
Every possible level.
Definition: logger.h:120
SASL protocol processing.
Definition: logger.h:100
Something went wrong.
Definition: logger.h:113
No subsystem.
Definition: logger.h:94
Language binding.
Definition: logger.h:101
TLS/SSL protocol processing.
Definition: logger.h:99
void pn_logger_set_log_sink(pn_logger_t *logger, pn_log_sink_t sink, intptr_t sink_context)
Set the tracing function used by a logger.
No level.
Definition: logger.h:111
intptr_t pn_logger_get_log_sink_context(pn_logger_t *logger)
Get the sink context used by a logger.
Protocol frame traces.
Definition: logger.h:118
pn_log_sink_t pn_logger_get_log_sink(pn_logger_t *logger)
Get the tracing function used by a logger.
Something unusual happened but not necessarily an error.
Definition: logger.h:114
pn_log_subsystem_t
Definitions for different subsystems that can log messages.
Definition: logger.h:93
Something that might be interesting happened.
Definition: logger.h:115
Events.
Definition: logger.h:97
Low level Input/Output.
Definition: logger.h:96
const char * pn_logger_subsystem_name(pn_log_subsystem_t subsystem)
Get a human readable name for a logger subsystem.
void(* pn_log_sink_t)(intptr_t sink_context, pn_log_subsystem_t subsystem, pn_log_level_t severity, const char *message)
Callback for sinking logger messages.
Definition: logger.h:126
Something is wrong and can&#39;t be fixed - probably a library bug.
Definition: logger.h:112
Raw protocol bytes.
Definition: logger.h:119
Something you might want to know about happened.
Definition: logger.h:116
Detail about something that happened.
Definition: logger.h:117
AMQP protocol processing.
Definition: logger.h:98
Every subsystem.
Definition: logger.h:102