|
|
|||
File indexing completed on 2025-12-16 09:40:54
0001 // Copyright 2022 The Abseil Authors. 0002 // 0003 // Licensed under the Apache License, Version 2.0 (the "License"); 0004 // you may not use this file except in compliance with the License. 0005 // You may obtain a copy of the License at 0006 // 0007 // https://www.apache.org/licenses/LICENSE-2.0 0008 // 0009 // Unless required by applicable law or agreed to in writing, software 0010 // distributed under the License is distributed on an "AS IS" BASIS, 0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0012 // See the License for the specific language governing permissions and 0013 // limitations under the License. 0014 // 0015 // ----------------------------------------------------------------------------- 0016 // File: log/vlog_is_on.h 0017 // ----------------------------------------------------------------------------- 0018 // 0019 // This header defines the `VLOG_IS_ON()` macro that controls the 0020 // variable-verbosity conditional logging. 0021 // 0022 // It's used by `VLOG` in log.h, or it can also be used directly like this: 0023 // 0024 // if (VLOG_IS_ON(2)) { 0025 // foo_server.RecomputeStatisticsExpensive(); 0026 // LOG(INFO) << foo_server.LastStatisticsAsString(); 0027 // } 0028 // 0029 // Each source file has an effective verbosity level that's a non-negative 0030 // integer computed from the `--vmodule` and `--v` flags. 0031 // `VLOG_IS_ON(n)` is true, and `VLOG(n)` logs, if that effective verbosity 0032 // level is greater than or equal to `n`. 0033 // 0034 // `--vmodule` takes a comma-delimited list of key=value pairs. Each key is a 0035 // pattern matched against filenames, and the values give the effective severity 0036 // level applied to matching files. '?' and '*' characters in patterns are 0037 // interpreted as single-character and zero-or-more-character wildcards. 0038 // Patterns including a slash character are matched against full pathnames, 0039 // while those without are matched against basenames only. One suffix (i.e. the 0040 // last . and everything after it) is stripped from each filename prior to 0041 // matching, as is the special suffix "-inl". 0042 // 0043 // Files are matched against globs in `--vmodule` in order, and the first match 0044 // determines the verbosity level. 0045 // 0046 // Files which do not match any pattern in `--vmodule` use the value of `--v` as 0047 // their effective verbosity level. The default is 0. 0048 // 0049 // SetVLogLevel helper function is provided to do limited dynamic control over 0050 // V-logging by appending to `--vmodule`. Because these go at the beginning of 0051 // the list, they take priority over any globs previously added. 0052 // 0053 // Resetting --vmodule will override all previous modifications to `--vmodule`, 0054 // including via SetVLogLevel. 0055 0056 #ifndef ABSL_LOG_VLOG_IS_ON_H_ 0057 #define ABSL_LOG_VLOG_IS_ON_H_ 0058 0059 #include "absl/log/absl_vlog_is_on.h" // IWYU pragma: export 0060 0061 // IWYU pragma: private, include "absl/log/log.h" 0062 0063 // Each VLOG_IS_ON call site gets its own VLogSite that registers with the 0064 // global linked list of sites to asynchronously update its verbosity level on 0065 // changes to --v or --vmodule. The verbosity can also be set by manually 0066 // calling SetVLogLevel. 0067 // 0068 // VLOG_IS_ON is not async signal safe, but it is guaranteed not to allocate 0069 // new memory. 0070 #define VLOG_IS_ON(verbose_level) ABSL_VLOG_IS_ON(verbose_level) 0071 0072 #endif // ABSL_LOG_VLOG_IS_ON_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|