|
24 | 24 | #include "absl/base/attributes.h" |
25 | 25 | #include "absl/base/config.h" |
26 | 26 | #include "absl/base/log_severity.h" |
| 27 | +#include "absl/log/internal/vlog_config.h" |
27 | 28 | #include "absl/strings/string_view.h" |
28 | 29 |
|
29 | 30 | namespace absl { |
@@ -152,6 +153,28 @@ ABSL_MUST_USE_RESULT bool ShouldPrependLogPrefix(); |
152 | 153 | // This function is async-signal-safe. |
153 | 154 | void EnableLogPrefix(bool on_off); |
154 | 155 |
|
| 156 | +//------------------------------------------------------------------------------ |
| 157 | +// Set Global VLOG Level |
| 158 | +//------------------------------------------------------------------------------ |
| 159 | +// |
| 160 | +// Sets the global `(ABSL_)VLOG(_IS_ON)` level to `log_level`. This level is |
| 161 | +// applied to any sites whose filename doesn't match any `module_pattern`. |
| 162 | +// Returns the prior value. |
| 163 | +inline int SetGlobalVLogLevel(int log_level) { |
| 164 | + return absl::log_internal::UpdateGlobalVLogLevel(log_level); |
| 165 | +} |
| 166 | + |
| 167 | +//------------------------------------------------------------------------------ |
| 168 | +// Set VLOG Level |
| 169 | +//------------------------------------------------------------------------------ |
| 170 | +// |
| 171 | +// Sets `(ABSL_)VLOG(_IS_ON)` level for `module_pattern` to `log_level`. This |
| 172 | +// allows programmatic control of what is normally set by the --vmodule flag. |
| 173 | +// Returns the level that previously applied to `module_pattern`. |
| 174 | +inline int SetVLogLevel(absl::string_view module_pattern, int log_level) { |
| 175 | + return absl::log_internal::PrependVModule(module_pattern, log_level); |
| 176 | +} |
| 177 | + |
155 | 178 | //------------------------------------------------------------------------------ |
156 | 179 | // Configure Android Native Log Tag |
157 | 180 | //------------------------------------------------------------------------------ |
|
0 commit comments