Line | Count | Source (jump to first uncovered line) |
1 | | #include "rar.hpp" |
2 | | |
3 | | |
4 | | static wchar LogName[NM]; |
5 | | static RAR_CHARSET LogCharset=RCH_DEFAULT; |
6 | | |
7 | | void InitLogOptions(const wchar *LogFileName,RAR_CHARSET CSet) |
8 | 0 | { |
9 | 0 | wcsncpyz(LogName,LogFileName,ASIZE(LogName)); |
10 | 0 | LogCharset=CSet; |
11 | 0 | } |
12 | | |
13 | | |
14 | | #ifndef SILENT |
15 | | void Log(const wchar *ArcName,const wchar *fmt,...) |
16 | | { |
17 | | // Preserve the error code for possible following system error message. |
18 | | int Code=ErrHandler.GetSystemErrorCode(); |
19 | | |
20 | | uiAlarm(UIALARM_ERROR); |
21 | | |
22 | | // This buffer is for format string only, not for entire output, |
23 | | // so it can be short enough. |
24 | | wchar fmtw[1024]; |
25 | | PrintfPrepareFmt(fmt,fmtw,ASIZE(fmtw)); |
26 | | |
27 | | safebuf wchar Msg[2*NM+1024]; |
28 | | va_list arglist; |
29 | | va_start(arglist,fmt); |
30 | | vswprintf(Msg,ASIZE(Msg),fmtw,arglist); |
31 | | va_end(arglist); |
32 | | eprintf(L"%ls",Msg); |
33 | | ErrHandler.SetSystemErrorCode(Code); |
34 | | } |
35 | | #endif |
36 | | |
37 | | |