// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_RTC_BASE_DIAGNOSTIC_LOGGING_H_ #define THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_RTC_BASE_DIAGNOSTIC_LOGGING_H_ #include <sstream> #include <string> #include "third_party/webrtc/api/scoped_refptr.h" #include "third_party/webrtc/rtc_base/checks.h" #include "third_party/webrtc/rtc_base/system/rtc_export.h" namespace rtc { ////////////////////////////////////////////////////////////////////// // Note that the non-standard LoggingSeverity aliases exist because they are // still in broad use. The meanings of the levels are: // LS_SENSITIVE: Information which should only be logged with the consent // of the user, due to privacy concerns. // LS_VERBOSE: This level is for data which we do not want to appear in the // normal debug log, but should appear in diagnostic logs. // LS_INFO: Chatty level used in debugging for all sorts of things, the default // in debug builds. // LS_WARNING: Something that may warrant investigation. // LS_ERROR: Something that should not have occurred. // LS_NONE: Set this as minimum severity to disable logging. // Note that LoggingSeverity is mapped over to chromiums verbosity levels where // anything lower than or equal to the current verbosity level is written to // file which is the opposite of logging severity in libjingle where higher // severity numbers than or equal to the current severity level are written to // file. Also, note that the values are explicitly defined here for convenience // since the command line flag must be set using numerical values. // TODO(tommi): To keep things simple, we should just use the same values for // these constants as Chrome does. enum LoggingSeverity { … }; // LogErrorContext assists in interpreting the meaning of an error value. enum LogErrorContext { … }; // Class that writes a log message to the logging delegate ("WebRTC logging // stream" in Chrome) and to Chrome's logging stream. class RTC_EXPORT DiagnosticLogMessage { … }; // This class is used to explicitly ignore values in the conditional // logging macros. This avoids compiler warnings like "value computed // is not used" and "statement has no effect". class LogMessageVoidify { … }; ////////////////////////////////////////////////////////////////////// // Logging Helpers ////////////////////////////////////////////////////////////////////// class LogMessage { … }; // TODO(grunell): Change name to InitDiagnosticLoggingDelegate or // InitDiagnosticLogging. Change also in init_webrtc.h/cc. // TODO(grunell): typedef the delegate function. RTC_EXPORT void InitDiagnosticLoggingDelegateFunction( void (*delegate)(const std::string&)); void SetExtraLoggingInit( void (*function)(void (*delegate)(const std::string&))); } // namespace rtc #endif // THIRD_PARTY_WEBRTC_OVERRIDES_WEBRTC_RTC_BASE_DIAGNOSTIC_LOGGING_H_