1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
15 #include "updatelogging.h"
17 UpdateLog::UpdateLog()
23 void UpdateLog::Init(NS_tchar
* sourcePathParam
,
24 const NS_tchar
* fileName
,
25 const NS_tchar
* alternateFileName
,
31 sourcePath
= sourcePathParam
;
32 NS_tchar logFile
[MAXPATHLEN
];
33 NS_tsnprintf(logFile
, sizeof(logFile
)/sizeof(logFile
[0]),
34 NS_T("%s/%s"), sourcePathParam
, fileName
);
36 if (alternateFileName
&& NS_taccess(logFile
, F_OK
))
38 NS_tsnprintf(logFile
, sizeof(logFile
)/sizeof(logFile
[0]),
39 NS_T("%s/%s"), sourcePathParam
, alternateFileName
);
42 logFP
= NS_tfopen(logFile
, append
? NS_T("a") : NS_T("w"));
45 void UpdateLog::Finish()
54 void UpdateLog::Flush()
62 void UpdateLog::Printf(const char *fmt
, ... )
69 vfprintf(logFP
, fmt
, ap
);
74 void UpdateLog::WarnPrintf(const char *fmt
, ... )
81 fprintf(logFP
, "*** Warning: ");
82 vfprintf(logFP
, fmt
, ap
);
83 fprintf(logFP
, "***\n");