Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef UPDATELOGGING_H |
michael@0 | 6 | #define UPDATELOGGING_H |
michael@0 | 7 | |
michael@0 | 8 | #include "updatedefines.h" |
michael@0 | 9 | #include <stdio.h> |
michael@0 | 10 | |
michael@0 | 11 | class UpdateLog |
michael@0 | 12 | { |
michael@0 | 13 | public: |
michael@0 | 14 | static UpdateLog & GetPrimaryLog() |
michael@0 | 15 | { |
michael@0 | 16 | static UpdateLog primaryLog; |
michael@0 | 17 | return primaryLog; |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | void Init(NS_tchar* sourcePath, const NS_tchar* fileName, |
michael@0 | 21 | const NS_tchar* alternateFileName, bool append); |
michael@0 | 22 | void Finish(); |
michael@0 | 23 | void Flush(); |
michael@0 | 24 | void Printf(const char *fmt, ... ); |
michael@0 | 25 | void WarnPrintf(const char *fmt, ... ); |
michael@0 | 26 | |
michael@0 | 27 | ~UpdateLog() |
michael@0 | 28 | { |
michael@0 | 29 | Finish(); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | protected: |
michael@0 | 33 | UpdateLog(); |
michael@0 | 34 | FILE *logFP; |
michael@0 | 35 | NS_tchar* sourcePath; |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | #define LOG_WARN(args) UpdateLog::GetPrimaryLog().WarnPrintf args |
michael@0 | 39 | #define LOG(args) UpdateLog::GetPrimaryLog().Printf args |
michael@0 | 40 | #define LogInit(PATHNAME_, FILENAME_) \ |
michael@0 | 41 | UpdateLog::GetPrimaryLog().Init(PATHNAME_, FILENAME_, 0, false) |
michael@0 | 42 | #define LogInitAppend(PATHNAME_, FILENAME_, ALTERNATE_) \ |
michael@0 | 43 | UpdateLog::GetPrimaryLog().Init(PATHNAME_, FILENAME_, ALTERNATE_, true) |
michael@0 | 44 | #define LogFinish() UpdateLog::GetPrimaryLog().Finish() |
michael@0 | 45 | #define LogFlush() UpdateLog::GetPrimaryLog().Flush() |
michael@0 | 46 | |
michael@0 | 47 | #endif |