2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * A "Log Receiver" that logs messages to a file
14 /// Basic WvLogRcv that logs to a file. Always logs to the same file.
15 /// No auto-rotation of log files.
16 class WvLogFileBase
: public WvLogRcv
, public WvFile
19 WvLogFileBase(WvStringParm _filename
,
20 WvLog::LogLevel _max_level
= WvLog::NUM_LOGLEVELS
);
22 // run fsync() every so many log messages. 0 never fsyncs.
26 WvLogFileBase(WvLog::LogLevel _max_level
);
27 virtual void _make_prefix(time_t now_sec
);
28 virtual void _mid_line(const char *str
, size_t len
);
29 virtual void _end_line();
35 /// A more advanced WvLogFileBase. Logs to a file named <filename>.<date>.
36 /// Deletes old log files after 'keep_for' days.
37 class WvLogFile
: public WvLogFileBase
40 WvLogFile(WvStringParm _filename
,
41 WvLog::LogLevel _max_level
= WvLog::NUM_LOGLEVELS
,
42 int _keep_for
= 7, bool _force_new_line
= false,
43 bool _allow_append
= true);
48 virtual void _make_prefix(time_t now_sec
);
49 int keep_for
, last_day
;
54 const char *wstype() const { return "WvLogFileBase"; }
57 #endif // __WVLOGFILE_H