Ignore:
Timestamp:
28/03/2008 22:18:44 (4 years ago)
Author:
chris
Message:

Improve logging with macros that consistently output strerror(errno) and
errno, replacing almost all use of strerror() in the main code.

Log a more detailed error message before throwing an exception for some
more system call failures.

Make FileStream? store its filename on all platforms, not just Windows.

Wrap some long lines at less than 80 characters to improve readability.

Fix some minor violations of coding standard (white space) and a typo
in a comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/common/Logging.h

    r2102 r2115  
    4848        if (Logging::IsEnabled(Log::TRACE)) \ 
    4949        { BOX_LOG(Log::TRACE, stuff) } 
     50 
     51#define BOX_LOG_SYS_WARNING(stuff) \ 
     52        BOX_WARNING(stuff << ": " << strerror(errno) << " (" << errno << ")") 
     53#define BOX_LOG_SYS_ERROR(stuff) \ 
     54        BOX_ERROR(stuff << ": " << strerror(errno) << " (" << errno << ")") 
     55#define BOX_LOG_SYS_FATAL(stuff) \ 
     56        BOX_FATAL(stuff << ": " << strerror(errno) << " (" << errno << ")") 
     57 
     58#ifdef WIN32 
     59        #define BOX_LOG_WIN_ERROR(stuff) \ 
     60                BOX_ERROR(stuff << ": " << GetErrorMessage(GetLastError())) 
     61        #define BOX_LOG_WIN_ERROR_NUMBER(stuff, number) \ 
     62                BOX_ERROR(stuff << ": " << GetErrorMessage(number)) 
     63#endif 
    5064 
    5165#define BOX_FORMAT_ACCOUNT(accno) \ 
Note: See TracChangeset for help on using the changeset viewer.