"Fossies" - the Fresh Open Source Software Archive

Member "unrar/log.cpp" (4 May 2022, 814 Bytes) of package /linux/misc/unrarsrc-6.1.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "log.cpp" see the Fossies "Dox" file reference documentation.

    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 {
    9   wcsncpyz(LogName,LogFileName,ASIZE(LogName));
   10   LogCharset=CSet;
   11 }
   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