00001 /* 00002 * liblogger - copyright 2007, Vineeth Neelakant, nvineeth@gmail.com 00003 * This file is part of liblogger. 00004 * 00005 * liblogger is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as published by 00007 * the Free Software Foundation; either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * liblogger 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 Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 #ifndef __FILE_LOGGER_H__ 00019 #define __FILE_LOGGER_H__ 00020 00021 #include <stdio.h> 00022 00023 /* The rollback feature has been disabled, due to limitations 00024 * in open modes of fopen(), will be enabled after further study. 00025 * */ 00026 #undef _ENABLE_LL_ROLLBACK_ 00027 00028 /** File open mode. 00029 * */ 00030 typedef enum tFileOpenMode 00031 { 00032 /** Indicates that the log file should be opened in append mode. */ 00033 AppendMode = 0x2, 00034 #ifdef _ENABLE_LL_ROLLBACK_ 00035 /** Rollback Mode : The log file will be opened in append mode and will 00036 * roll back when the size indicated 00037 * by \ref tFileLoggerInitParams::rollbackSize is reached. 00038 * */ 00039 RollbackMode 00040 #endif // _ENABLE_LL_ROLLBACK_ 00041 } tFileOpenMode; 00042 00043 /** File Logger Initialization parameters. */ 00044 typedef struct tFileLoggerInitParams 00045 { 00046 /** The filename of the log. */ 00047 char* fileName; 00048 /** The file open mode. */ 00049 tFileOpenMode fileOpenMode; 00050 #ifdef _ENABLE_LL_ROLLBACK_ 00051 /** The rollback size in \b bytes to use, when \ref tFileLoggerInitParams::fileOpenMode "fileOpenMode" 00052 * is equal \ref tFileOpenMode::RollbackMode "RollbackMode" 00053 * */ 00054 unsigned long rollbackSize; 00055 #endif // _ENABLE_LL_ROLLBACK_ 00056 }tFileLoggerInitParams; 00057 00058 #endif // __FILE_LOGGER_H__