4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
9 * This copyrighted material is made available to anyone wishing to use,
10 * modify, copy, or redistribute it subject to the terms and conditions
11 * of the GNU Lesser General Public License v.2.1.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #ifndef _LVM_LOGGING_H
19 #define _LVM_LOGGING_H
21 void print_log(int level
, const char *file
, int line
, int dm_errno
,
22 const char *format
, ...)
23 __attribute__ ((format(printf
, 5, 6)));
25 #define LOG_LINE(l, x...) \
26 print_log(l, __FILE__, __LINE__ , 0, ## x)
28 #define LOG_LINE_WITH_ERRNO(l, e, x...) \
29 print_log(l, __FILE__, __LINE__ , e, ## x)
33 typedef void (*lvm2_log_fn_t
) (int level
, const char *file
, int line
,
34 int dm_errno
, const char *message
);
36 void init_log_fn(lvm2_log_fn_t log_fn
);
38 void init_indent(int indent
);
39 void init_msg_prefix(const char *prefix
);
41 void init_log_file(const char *log_file
, int append
);
42 void init_log_direct(const char *log_file
, int append
);
43 void init_log_while_suspended(int log_while_suspended
);
46 void release_log_memory(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
);