• Adam Simpkins's avatar
    logging: support stripping directory prefixes from file names · 21d80675
    Adam Simpkins authored
    Summary:
    The XLOG() macros compute the log category based on the source file name, as
    defined by `__FILE__`.  Both gcc and clang set the `__FILE__` contents to the
    file name passed in on the command line, so if they are invoked with absolute
    path names `__FILE__` will contain an absolute path.  This is normally
    undesirable for `XLOG()` behavior.  Furthermore, CMake always invokes the
    compiler with absolute path names, so it is difficult to avoid this situation
    in open source builds.
    
    This adds support for a `FOLLY_XLOG_STRIP_PREFIXES` macro.  This can be defined
    to a string containing a colon-separated list of directory prefixes to strip
    from `__FILE__` before using it to compute the log category name.  If
    `FOLLY_XLOG_STRIP_PREFIXES` is not defined then the code continues to use
    `__FILE__` as-is.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D6868773
    
    fbshipit-source-id: a5c3276d8d22d3b27ae621700a75b1362d049292
    21d80675
CMakeLists.txt 27.5 KB