Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
nulllogentrywriter.h
Go to the documentation of this file.
1 
18 #ifndef ION_BASE_NULLLOGENTRYWRITER_H_
19 #define ION_BASE_NULLLOGENTRYWRITER_H_
20 
21 #include <ostream> // NOLINT
22 
23 #include "ion/base/logging.h"
24 
25 namespace ion {
26 namespace base {
27 
49 class ION_API NullLogEntryWriter : public port::LogEntryWriter {
50  public:
51  NullLogEntryWriter() : previous_writer_(GetLogEntryWriter()) {
52  SetLogEntryWriter(this);
53  }
54  ~NullLogEntryWriter() override {
56  SetLogEntryWriter(previous_writer_);
57  }
58 
60  void Write(port::LogSeverity severity, const std::string& message) override {}
61 
62  private:
63  port::LogEntryWriter* previous_writer_;
64 };
65 
66 } // namespace base
67 } // namespace ion
68 
69 #endif // ION_BASE_NULLLOGENTRYWRITER_H_
void Write(port::LogSeverity severity, const std::string &message) override
LogEntryWriter impl.
Abstract class which can be overridden to integrate Ion logging with other logging systems...
Definition: logging.h:36
NullLogEntryWriter()
LogSeverity
Definition: logging.h:26
A NullLogEntryWriter can be used completely disable all logging programmatically as long as it exists...
~NullLogEntryWriter() override
port::LogEntryWriter * GetLogEntryWriter()
Returns the log-writer that messages are currently logged to.
Definition: logging.cc:192
Copyright 2016 Google Inc.
void SetLogEntryWriter(port::LogEntryWriter *w)
Public functions.
Definition: logging.cc:188