1 /* $NetBSD: lvm-logging.h,v 1.1.1.1 2008/12/22 00:17:52 haad Exp $ */ 2 3 /* 4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 5 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 6 * 7 * This file is part of LVM2. 8 * 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. 12 * 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 16 */ 17 18 #ifndef _LVM_LOGGING_H 19 #define _LVM_LOGGING_H 20 21 void print_log(int level, const char *file, int line, const char *format, ...) 22 __attribute__ ((format(printf, 4, 5))); 23 24 #define plog(l, x...) print_log(l, __FILE__, __LINE__ , ## x) 25 26 #include "log.h" 27 28 typedef void (*lvm2_log_fn_t) (int level, const char *file, int line, 29 const char *message); 30 31 void init_log_fn(lvm2_log_fn_t log_fn); 32 33 void init_indent(int indent); 34 void init_msg_prefix(const char *prefix); 35 36 void init_log_file(const char *log_file, int append); 37 void init_log_direct(const char *log_file, int append); 38 void init_log_while_suspended(int log_while_suspended); 39 40 void fin_log(void); 41 void release_log_memory(void); 42 43 void init_syslog(int facility); 44 void fin_syslog(void); 45 46 int error_message_produced(void); 47 48 /* Suppress messages to stdout/stderr (1) or everywhere (2) */ 49 /* Returns previous setting */ 50 int log_suppress(int suppress); 51 52 /* Suppress messages to syslog */ 53 void syslog_suppress(int suppress); 54 55 #endif 56