forked from pmachapman/unrar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.cpp
37 lines (27 loc) · 814 Bytes
/
log.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "rar.hpp"
static wchar LogName[NM];
static RAR_CHARSET LogCharset=RCH_DEFAULT;
void InitLogOptions(const wchar *LogFileName,RAR_CHARSET CSet)
{
wcsncpyz(LogName,LogFileName,ASIZE(LogName));
LogCharset=CSet;
}
#ifndef SILENT
void Log(const wchar *ArcName,const wchar *fmt,...)
{
// Preserve the error code for possible following system error message.
int Code=ErrHandler.GetSystemErrorCode();
uiAlarm(UIALARM_ERROR);
// This buffer is for format string only, not for entire output,
// so it can be short enough.
wchar fmtw[1024];
PrintfPrepareFmt(fmt,fmtw,ASIZE(fmtw));
safebuf wchar Msg[2*NM+1024];
va_list arglist;
va_start(arglist,fmt);
vswprintf(Msg,ASIZE(Msg),fmtw,arglist);
va_end(arglist);
eprintf(L"%ls",Msg);
ErrHandler.SetSystemErrorCode(Code);
}
#endif