1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
/*
* Copyright (C) 2011 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Angus Salkeld <asalkeld@redhat.com>
*
* libqb is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or
* (at your option) any later version.
*
* libqb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libqb. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QB_LOG_INT_H_
#define _QB_LOG_INT_H_
#include <qb/qblist.h>
#include <qb/qblog.h>
#include <qb/qbrb.h>
struct qb_log_target;
struct qb_log_target {
uint32_t pos;
enum qb_log_target_state state;
char name[PATH_MAX];
char filename[PATH_MAX];
struct qb_list_head filter_head;
int32_t facility;
int32_t priority_bump;
int32_t debug;
size_t size;
char *format;
int32_t threaded;
void *instance;
qb_log_reload_fn reload;
qb_log_close_fn close;
qb_log_logger_fn logger;
qb_log_vlogger_fn vlogger;
};
struct qb_log_filter {
enum qb_log_filter_conf conf;
enum qb_log_filter_type type;
char *text;
uint8_t high_priority;
uint8_t low_priority;
uint32_t new_value;
struct qb_list_head list;
};
struct qb_log_record {
struct qb_log_callsite *cs;
time_t timestamp;
char *buffer;
struct qb_list_head list;
};
#define TIME_STRING_SIZE 64
struct qb_log_target * qb_log_target_alloc(void);
void qb_log_target_free(struct qb_log_target *t);
struct qb_log_target * qb_log_target_get(int32_t pos);
int32_t qb_log_syslog_open(struct qb_log_target *t);
int32_t qb_log_stderr_open(struct qb_log_target *t);
int32_t qb_log_blackbox_open(struct qb_log_target *t);
void qb_log_thread_stop(void);
void qb_log_thread_log_post(struct qb_log_callsite *cs,
time_t current_time,
const char *buffer);
void qb_log_thread_log_write(struct qb_log_callsite *cs,
time_t current_time,
const char *buffer);
void qb_log_dcs_init(void);
void qb_log_dcs_fini(void);
struct qb_log_callsite *qb_log_dcs_get(int32_t *newly_created,
const char *function,
const char *filename,
const char *format,
uint8_t priority,
uint32_t lineno,
uint32_t tags);
size_t qb_vsprintf_serialize(char *serialize, const char *fmt, va_list ap);
size_t qb_vsnprintf_deserialize(char *string, size_t str_len, const char *buf);
void qb_log_target_format_static(int32_t target, const char * format, char *output_buffer);
#endif /* _QB_LOG_INT_H_ */
|