• Adam Simpkins's avatar
    logging: add XLOG() and XLOGF() logging macros · 9e55caa8
    Adam Simpkins authored
    Summary:
    This adds new `XLOG()` and `XLOGF()` macros to the logging library.  These are
    similar to `FB_LOG()` and `FB_LOGF()`, but do not require a Logger argument.
    Instead, the log category is picked automatically based on the current file
    name.  The basic algorithm for picking the category name is to replace
    directory separators with '.', and to strip off the filename extension.
    
    For instance, all `XLOG()` statements in `src/foo/bar.cpp` will log to the
    category `src.foo.bar`.  This also works correctly in header files: `XLOG()`
    statements in `src/foo/mylib.h` will log to `src.foo.mylib`
    
    This should generally result in a good log category hierarchy without the user
    having to spend additional time picking category names--we simply re-use the
    decisions that they already made for their directory layout.
    
    In general I expect the `XLOG()` macros to be convenient enough that users will
    use `XLOG()` in almost all cases rather than using `FB_LOG()`.
    
    The log category name used by `XLOG()` statements can be overridden using
    `XLOG_SET_CATEGORY()`, but this only works in .cpp files, not in header files.
    
    Reviewed By: wez
    
    Differential Revision: D4920257
    
    fbshipit-source-id: 7ffafd9a4c87e6fb5eb35d86e0eb86ef1ed5be95
    9e55caa8
CMakeLists.txt 21.8 KB