|
|
|||
File indexing completed on 2025-12-16 09:40:52
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/internal/globals.h 0017 // ----------------------------------------------------------------------------- 0018 // 0019 // This header file contains various global objects and static helper routines 0020 // use in logging implementation. 0021 0022 #ifndef ABSL_LOG_INTERNAL_GLOBALS_H_ 0023 #define ABSL_LOG_INTERNAL_GLOBALS_H_ 0024 0025 #include "absl/base/config.h" 0026 #include "absl/base/log_severity.h" 0027 #include "absl/strings/string_view.h" 0028 #include "absl/time/time.h" 0029 0030 namespace absl { 0031 ABSL_NAMESPACE_BEGIN 0032 namespace log_internal { 0033 0034 // IsInitialized returns true if the logging library is initialized. 0035 // This function is async-signal-safe 0036 bool IsInitialized(); 0037 0038 // SetLoggingInitialized is called once after logging initialization is done. 0039 void SetInitialized(); 0040 0041 // Unconditionally write a `message` to stderr. If `severity` exceeds kInfo 0042 // we also flush the stderr stream. 0043 void WriteToStderr(absl::string_view message, absl::LogSeverity severity); 0044 0045 // Set the TimeZone used for human-friendly times (for example, the log message 0046 // prefix) printed by the logging library. This may only be called once. 0047 void SetTimeZone(absl::TimeZone tz); 0048 0049 // Returns the TimeZone used for human-friendly times (for example, the log 0050 // message prefix) printed by the logging library Returns nullptr prior to 0051 // initialization. 0052 const absl::TimeZone* TimeZone(); 0053 0054 // Returns true if stack traces emitted by the logging library should be 0055 // symbolized. This function is async-signal-safe. 0056 bool ShouldSymbolizeLogStackTrace(); 0057 0058 // Enables or disables symbolization of stack traces emitted by the 0059 // logging library. This function is async-signal-safe. 0060 void EnableSymbolizeLogStackTrace(bool on_off); 0061 0062 // Returns the maximum number of frames that appear in stack traces 0063 // emitted by the logging library. This function is async-signal-safe. 0064 int MaxFramesInLogStackTrace(); 0065 0066 // Sets the maximum number of frames that appear in stack traces emitted by 0067 // the logging library. This function is async-signal-safe. 0068 void SetMaxFramesInLogStackTrace(int max_num_frames); 0069 0070 // Determines whether we exit the program for a LOG(DFATAL) message in 0071 // debug mode. It does this by skipping the call to Fail/FailQuietly. 0072 // This is intended for testing only. 0073 // 0074 // This can have some effects on LOG(FATAL) as well. Failure messages 0075 // are always allocated (rather than sharing a buffer), the crash 0076 // reason is not recorded, the "gwq" status message is not updated, 0077 // and the stack trace is not recorded. The LOG(FATAL) *will* still 0078 // exit the program. Since this function is used only in testing, 0079 // these differences are acceptable. 0080 // 0081 // Additionally, LOG(LEVEL(FATAL)) is indistinguishable from LOG(DFATAL) and 0082 // will not terminate the program if SetExitOnDFatal(false) has been called. 0083 bool ExitOnDFatal(); 0084 0085 // SetExitOnDFatal() sets the ExitOnDFatal() status 0086 void SetExitOnDFatal(bool on_off); 0087 0088 // Determines if the logging library should suppress logging of stacktraces in 0089 // the `SIGABRT` handler, typically because we just logged a stacktrace as part 0090 // of `LOG(FATAL)` and are about to send ourselves a `SIGABRT` to end the 0091 // program. 0092 bool SuppressSigabortTrace(); 0093 0094 // Sets the SuppressSigabortTrace() status and returns the previous state. 0095 bool SetSuppressSigabortTrace(bool on_off); 0096 0097 } // namespace log_internal 0098 ABSL_NAMESPACE_END 0099 } // namespace absl 0100 0101 #endif // ABSL_LOG_INTERNAL_GLOBALS_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|