diff options
Diffstat (limited to 'components/proximity_auth/logging/logging.cc')
-rw-r--r-- | components/proximity_auth/logging/logging.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/components/proximity_auth/logging/logging.cc b/components/proximity_auth/logging/logging.cc new file mode 100644 index 0000000..544904a --- /dev/null +++ b/components/proximity_auth/logging/logging.cc @@ -0,0 +1,27 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/proximity_auth/logging/logging.h" + +#include "components/proximity_auth/logging/log_buffer.h" + +namespace proximity_auth { + +ScopedLogMessage::ScopedLogMessage(const char* file, + int line, + logging::LogSeverity severity) + : file_(file), line_(line), severity_(severity) { +} + +ScopedLogMessage::~ScopedLogMessage() { + LogBuffer::GetInstance()->AddLogMessage(LogBuffer::LogMessage( + stream_.str(), base::Time::Now(), file_, line_, severity_)); + + // The destructor of |log_message| also creates a log for the standard logging + // system. + logging::LogMessage log_message(file_, line_, severity_); + log_message.stream() << stream_.str(); +} + +} // proximity_auth |