| 1 |
/* |
| 2 |
* Copyright (C) 2016 Jan Pokorny <[email protected]> |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This software is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License along |
| 15 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 16 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <qb/qblog.h> |
| 20 |
|
| 21 |
#include "b_config.h" |
| 22 |
|
| 23 |
/* qb logging compat definitions */ |
| 24 |
#if (!defined LOGGING_LIBQB_MAJOR || (LOGGING_LIBQB_MAJOR < 1)) |
| 25 |
enum tmp_log_target_slot { |
| 26 |
TMP_LOG_SYSLOG = QB_LOG_SYSLOG, |
| 27 |
TMP_LOG_STDERR = QB_LOG_STDERR, |
| 28 |
TMP_LOG_BLACKBOX = QB_LOG_BLACKBOX, |
| 29 |
TMP_LOG_TARGET_MAX = QB_LOG_TARGET_MAX, |
| 30 |
}; |
| 31 |
|
| 32 |
#undef QB_LOG_SYSLOG |
| 33 |
#undef QB_LOG_STDERR |
| 34 |
#undef QB_LOG_BLACKBOX |
| 35 |
#undef QB_LOG_TARGET_MAX |
| 36 |
|
| 37 |
enum qb_log_target_slot { |
| 38 |
QB_LOG_TARGET_START, |
| 39 |
QB_LOG_SYSLOG = TMP_LOG_SYSLOG, |
| 40 |
QB_LOG_STDERR = TMP_LOG_STDERR, |
| 41 |
QB_LOG_BLACKBOX = TMP_LOG_BLACKBOX, |
| 42 |
QB_LOG_TARGET_MAX = TMP_LOG_TARGET_MAX, |
| 43 |
}; |
| 44 |
|
| 45 |
#define QB_LOG_CTL2_S(a) (a) |
| 46 |
#define qb_log_ctl2(t, s, a) ((void) 0) |
| 47 |
#endif |
| 48 |
|
| 49 |
|
| 50 |
#ifndef HA_LOG_FACILITY |
| 51 |
/* based on glue/configure.ac of glue project: http://hg.linux-ha.org/glue */ |
| 52 |
#define HA_LOG_FACILITY LOG_DAEMON |
| 53 |
#endif |
| 54 |
|
| 55 |
extern int debug_level; |
| 56 |
#define ANYDEBUG (debug_level) |
| 57 |
|
| 58 |
void alt_qb_inherit_logging_environment(void); |
| 59 |
|
| 60 |
#define cl_log_set_entity(ent) \ |
| 61 |
(void) qb_log_ctl2(QB_LOG_SYSLOG, QB_LOG_CONF_IDENT, QB_LOG_CTL2_S(ent)) |
| 62 |
|
| 63 |
#define cl_log_enable_stderr(b) \ |
| 64 |
(void) qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, b ? QB_TRUE : QB_FALSE) |
| 65 |
|
| 66 |
#define cl_log_set_facility(f) \ |
| 67 |
(void) qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_FACILITY, f) |
| 68 |
|
| 69 |
#define cl_inherit_logging_environment(logqueuemax) \ |
| 70 |
alt_qb_inherit_logging_environment() |