2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 #ifndef _LVM_LOGGING_H
17 #define _LVM_LOGGING_H
19 void print_log(int level, const char *file, int line, int dm_errno,
20 const char *format, ...)
21 __attribute__ ((format(printf, 5, 6)));
23 #define LOG_LINE(l, x...) \
24 print_log(l, __FILE__, __LINE__ , 0, ## x)
26 #define LOG_LINE_WITH_ERRNO(l, e, x...) \
27 print_log(l, __FILE__, __LINE__ , e, ## x)
31 typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
32 int dm_errno, const char *message);
34 void init_log_fn(lvm2_log_fn_t log_fn);
36 void init_indent(int indent);
37 void init_msg_prefix(const char *prefix);
39 void init_log_file(const char *log_file, int append);
40 void init_log_direct(const char *log_file, int append);
41 void init_log_while_suspended(int log_while_suspended);
42 void init_abort_on_internal_errors(int fatal);
45 void release_log_memory(void);
46 void reset_log_duplicated(void);
48 void init_syslog(int facility);
49 void fin_syslog(void);
51 int error_message_produced(void);
52 void reset_lvm_errno(int store_errmsg);
53 int stored_errno(void);
54 const char *stored_errmsg(void);
56 /* Suppress messages to stdout/stderr (1) or everywhere (2) */
57 /* Returns previous setting */
58 int log_suppress(int suppress);
60 /* Suppress messages to syslog */
61 void syslog_suppress(int suppress);