Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvlogfile.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * A "Log Receiver" that logs messages to a file 
00006  */
00007 
00008 #ifndef __WVLOGFILE_H
00009 #define __WVLOGFILE_H
00010 
00011 #include "wvdailyevent.h"
00012 #include "wvfile.h"
00013 #include "wvlogrcv.h"
00014 #include <fcntl.h>
00015 
00016 // Basic LogFile receiver. Always logs to the same file. No rotation.
00017 
00018 class WvLogFileBase : public WvLogRcv, public WvFile
00019 {
00020     public:
00021         WvLogFileBase(WvStringParm _filename, WvLog::LogLevel _max_level
00022              = WvLog::NUM_LOGLEVELS) : WvLogRcv(_max_level),
00023              WvFile(_filename, O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0644) {};
00024 
00025     protected:
00026         WvLogFileBase(WvLog::LogLevel _max_level) : WvLogRcv(_max_level) {};
00027         virtual void _make_prefix(); 
00028         virtual void _mid_line(const char *str, size_t len);
00029 };
00030 
00031 // A more advanced LogFile. Logs <filename>.<date>
00032 //  Deletes old log files after 'keep_for' days
00033 
00034 class WvLogFile : public WvLogFileBase
00035 {
00036     public:
00037         WvLogFile(WvStringParm _filename, WvLog::LogLevel _max_level
00038             = WvLog::NUM_LOGLEVELS, int _keep_for = 7);
00039     private:
00040         virtual void _make_prefix(); 
00041         void start_log();
00042         int keep_for, last_day;
00043         WvString filename;
00044 };
00045 
00046 #endif // __WVLOGFILE_H

Generated on Sat Mar 13 14:55:48 2004 for WvStreams by doxygen 1.3.6-20040222