logging: don't clamp the log level to DFATAL in debug builds
Summary: Remove the logic that clamps the log level to DFATAL in debug builds. This behavior logically makes some sense, but results in subtle and potentially confusing behavior changes. It seems confusing that after calling `setLevel(LogLevel::MAX_LEVEL)` on a log category, calling `getLevel()` on that object would return `DFATAL` rather than `MAX_LEVEL`. We also weren't clamping the level to DFATAL consistently: `setLevel()` would clamp the value, but on construction the initial level was still set to MAX_LEVEL rather than DFATAL. This resulted in some issues when implementing `LoggerDB::getConfig()` since we could not consistently detect if a log category was using the default level settings. Rather than fix this inconsistency it seems better to simply remove this clamping behavior. This means that it is possible for users to disable DFATAL log messages even in debug builds if they really want to. Previously this was only allowed in release builds. This protection doesn't really seem all that valuable--presumably most developers won't really want to do this, and if they really do request this configuration it doesn't seem all that bad to honor it. Reviewed By: bolinfest, yfeldblum Differential Revision: D6200569 fbshipit-source-id: 83ef8e2e4d3b61bc5b105038cbe3132979e9ac67
Showing
Please register or sign in to comment