windows-misc-20050102
[openafs.git] / src / WINNT / afssvrcfg / logfile.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <windows.h>
11 #include <stdio.h>
12
13 enum LOGFILE_TIMESTAMP_MODE { TSM_NEVER, TSM_AT_OPEN_AND_CLOSE, TSM_EACH_ENTRY };
14 enum LOGFILE_OPEN_MODE          { OM_OVERWRITE, OM_APPEND };
15
16
17 class LOGFILE
18 {
19         FILE *m_fp;
20
21         char m_szPath[MAX_PATH];
22
23         LOGFILE_TIMESTAMP_MODE m_eTimeStampMode;
24
25 public:
26         LOGFILE();
27         ~LOGFILE();
28
29         BOOL Open(      const char                              *pszLogFilePath, 
30                                 LOGFILE_OPEN_MODE               eOpenMode = OM_OVERWRITE,
31                                 LOGFILE_TIMESTAMP_MODE  eTimeStampMode = TSM_EACH_ENTRY
32                          );
33         BOOL Close();
34
35         char *GetPath() { return m_szPath; }
36
37         BOOL Write(const char *pszMsg, ...);
38
39         BOOL WriteError(const char *pszMsg, DWORD nErrorCode, ...);
40
41         BOOL WriteMultistring(const char *pszMultiStr);
42
43         BOOL WriteTimeStamp();
44
45         BOOL WriteBoolResult(BOOL bResult);
46 };
47