00001 #ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_LOG_H 00002 #define INCLUDES_MYSQL_INSTANCE_MANAGER_LOG_H 00003 /* Copyright (C) 2003 MySQL AB & MySQL Finland AB & TCX DataKonsult AB 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00018 00019 /* 00020 Logging facilities. 00021 00022 Two logging streams are supported: error log and info log. Additionally 00023 libdbug may be used for debug information output. 00024 ANSI C buffered I/O is used to perform logging. 00025 Logging is performed via stdout/stder, so one can reopen them to point to 00026 ordinary files. To initialize loggin environment log_init() must be called. 00027 00028 Rationale: 00029 - no MYSQL_LOG as it has BIN mode, and not easy to fetch from sql_class.h 00030 - no constructors/desctructors to make logging available all the time 00031 Function names are subject to change. 00032 */ 00033 00034 00035 /* Precede error message with date and time and print it to the stdout */ 00036 void log_info(const char *format, ...) 00037 #ifdef __GNUC__ 00038 __attribute__ ((format(printf, 1, 2))) 00039 #endif 00040 ; 00041 00042 00043 /* Precede error message with date and time and print it to the stderr */ 00044 void log_error(const char *format, ...) 00045 #ifdef __GNUC__ 00046 __attribute__ ((format (printf, 1, 2))) 00047 #endif 00048 ; 00049 00050 00051 /* 00052 Now this is simple catchouts for printf (no date/time is logged), to be 00053 able to replace underlying streams in future. 00054 */ 00055 00056 void print_info(const char *format, ...) 00057 #ifdef __GNUC__ 00058 __attribute__ ((format (printf, 1, 2))) 00059 #endif 00060 ; 00061 00062 00063 void print_error(const char *format, ...) 00064 #ifdef __GNUC__ 00065 __attribute__ ((format (printf, 1, 2))) 00066 #endif 00067 ; 00068 00069 /* initialize logs */ 00070 void log_init(); 00071 00072 00073 /* print information to the error log and eixt(1) */ 00074 00075 void die(const char *format, ...) 00076 #ifdef __GNUC__ 00077 __attribute__ ((format (printf, 1, 2))) 00078 #endif 00079 ; 00080 00081 #endif // INCLUDES_MYSQL_INSTANCE_MANAGER_LOG_H
1.4.7

