| 1 |
#ifndef LOG_PRIVATE_H |
| 2 |
#define LOG_PRIVATE_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 |
|
| 22 |
/**@file |
| 23 |
* |
| 24 |
* Log messages that are not associated with a transport. |
| 25 |
*/ |
| 26 |
|
| 27 |
#include <proton/log.h> |
| 28 |
#include <stdarg.h> |
| 29 |
|
| 30 |
/** Log a printf style message */ |
| 31 |
#define pn_logf(...) \ |
| 32 |
do { \ |
| 33 |
if (pni_log_enabled()) \ |
| 34 |
pni_logf_impl(__VA_ARGS__); \ |
| 35 |
} while(0) |
| 36 |
|
| 37 |
/** va_list version of pn_logf */ |
| 38 |
#define pn_vlogf(fmt, ap) \ |
| 39 |
do { \ |
| 40 |
if (pni_log_enabled()) \ |
| 41 |
pni_vlogf_impl(fmt, ap); \ |
| 42 |
} while(0) |
| 43 |
|
| 44 |
/** Return true if logging is enabled. */ |
| 45 |
PN_EXTERN bool pni_log_enabled(void); |
| 46 |
|
| 47 |
/**@internal*/ |
| 48 |
PN_EXTERN void pni_logf_impl(const char* fmt, ...); |
| 49 |
/**@internal*/ |
| 50 |
PN_EXTERN void pni_vlogf_impl(const char *fmt, va_list ap); |
| 51 |
|
| 52 |
/**@internal*/ |
| 53 |
void pn_log_data(const char *msg, const char *bytes, size_t size); |
| 54 |
|
| 55 |
|
| 56 |
#endif |