Skip to content

geipel/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

logger

C++ log abstraction

Inspiration

The Dr.Dobb's Journal (no longer in print) had published some articles that used the C++ left-shift operator (operator()<<) to define a logger based on std::ostream<>.

Unfortunately, I cannot seem to retrieve either article or code from the website, anymore. But as I recall, the basic premise was to take advantage of a destructer called when the temporary instance representing a logger "line" goes out-of-scope.

These articles had been written without C++11, and I've used this theme multiple times since, to use more recent language features. However, one of the more obnoxious issues was the persistent need for C macros, to report the line number and file name from the source code (via __LINE__ and __FILE__).

Fortunately, C++20 has the new source_location feature. 😃

Goals

  • Implement logger from scratch in C++20, without macros, to support std::ostream<>.
  • Thread safe
  • Exception safe
  • Portable
  • Efficient (limited overhead when optimized)
  • Const-correct semantics
  • Fully unit-tested
  • Use stack where possible.
  • Characterize use of heap.
  • Investigate limited support for async-signal safe usage.

Releases

No releases published

Packages

No packages published