1*7c604eeaShaad /* $NetBSD: lvm-logging.h,v 1.1.1.2 2009/12/02 00:26:21 haad Exp $ */ 256a34939Shaad 356a34939Shaad /* 456a34939Shaad * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. 556a34939Shaad * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 656a34939Shaad * 756a34939Shaad * This file is part of LVM2. 856a34939Shaad * 956a34939Shaad * This copyrighted material is made available to anyone wishing to use, 1056a34939Shaad * modify, copy, or redistribute it subject to the terms and conditions 1156a34939Shaad * of the GNU Lesser General Public License v.2.1. 1256a34939Shaad * 1356a34939Shaad * You should have received a copy of the GNU Lesser General Public License 1456a34939Shaad * along with this program; if not, write to the Free Software Foundation, 1556a34939Shaad * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1656a34939Shaad */ 1756a34939Shaad 1856a34939Shaad #ifndef _LVM_LOGGING_H 1956a34939Shaad #define _LVM_LOGGING_H 2056a34939Shaad 21*7c604eeaShaad void print_log(int level, const char *file, int line, int dm_errno, 22*7c604eeaShaad const char *format, ...) 23*7c604eeaShaad __attribute__ ((format(printf, 5, 6))); 2456a34939Shaad 25*7c604eeaShaad #define LOG_LINE(l, x...) \ 26*7c604eeaShaad print_log(l, __FILE__, __LINE__ , 0, ## x) 27*7c604eeaShaad 28*7c604eeaShaad #define LOG_LINE_WITH_ERRNO(l, e, x...) \ 29*7c604eeaShaad print_log(l, __FILE__, __LINE__ , e, ## x) 3056a34939Shaad 3156a34939Shaad #include "log.h" 3256a34939Shaad 3356a34939Shaad typedef void (*lvm2_log_fn_t) (int level, const char *file, int line, 34*7c604eeaShaad int dm_errno, const char *message); 3556a34939Shaad 3656a34939Shaad void init_log_fn(lvm2_log_fn_t log_fn); 3756a34939Shaad 3856a34939Shaad void init_indent(int indent); 3956a34939Shaad void init_msg_prefix(const char *prefix); 4056a34939Shaad 4156a34939Shaad void init_log_file(const char *log_file, int append); 4256a34939Shaad void init_log_direct(const char *log_file, int append); 4356a34939Shaad void init_log_while_suspended(int log_while_suspended); 4456a34939Shaad 4556a34939Shaad void fin_log(void); 4656a34939Shaad void release_log_memory(void); 4756a34939Shaad 4856a34939Shaad void init_syslog(int facility); 4956a34939Shaad void fin_syslog(void); 5056a34939Shaad 5156a34939Shaad int error_message_produced(void); 52*7c604eeaShaad void reset_lvm_errno(int store_errmsg); 53*7c604eeaShaad int stored_errno(void); 54*7c604eeaShaad const char *stored_errmsg(void); 5556a34939Shaad 5656a34939Shaad /* Suppress messages to stdout/stderr (1) or everywhere (2) */ 5756a34939Shaad /* Returns previous setting */ 5856a34939Shaad int log_suppress(int suppress); 5956a34939Shaad 6056a34939Shaad /* Suppress messages to syslog */ 6156a34939Shaad void syslog_suppress(int suppress); 6256a34939Shaad 6356a34939Shaad #endif 64