summaryrefslogtreecommitdiffstats
path: root/remoting/host/logging_win.cc
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 01:59:29 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 01:59:29 +0000
commitbc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4 (patch)
treeac6428717f771c967be2b82dca409f8232bce8d6 /remoting/host/logging_win.cc
parentf36f84cc1be4e03a921e365ff7b9c93a8cd6c325 (diff)
downloadchromium_src-bc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4.zip
chromium_src-bc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4.tar.gz
chromium_src-bc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4.tar.bz2
Redirect Chromoting Host debug logs to Windows event tracing (ETW) instead of a file on disk.
This CL prevents infinite growth of debug.log over time. The debug output is redirected to ETW logging. Sawbuck (http://code.google.com/p/sawbuck/) or standard ETW tools can be used to view the debug output. The debug build still uses "debug.log" (along with ETW) to simplify debugging. The installation registers "Chromoting" provider with Sawbuck and deletes the existing "debug.log" file during both installation and uninstallation. BUG=156135 Review URL: https://chromiumcodereview.appspot.com/11188016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/logging_win.cc')
-rw-r--r--remoting/host/logging_win.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/remoting/host/logging_win.cc b/remoting/host/logging_win.cc
new file mode 100644
index 0000000..0ab6f59
--- /dev/null
+++ b/remoting/host/logging_win.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 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 "remoting/host/logging.h"
+
+#include <guiddef.h>
+
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "base/logging_win.h"
+#include "remoting/host/branding.h"
+
+// {2db51ca1-4fd8-4b88-b5a2-fb8606b66b02}
+const GUID kRemotingHostLogProvider =
+ { 0x2db51ca1, 0x4fd8, 0x4b88,
+ { 0xb5, 0xa2, 0xfb, 0x86, 0x06, 0xb6, 0x6b, 0x02 } };
+
+namespace remoting {
+
+void InitHostLogging() {
+#if defined(NDEBUG)
+ // Write logs to the system debug log in release build.
+ logging::InitLogging(
+ NULL,
+ logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
+ logging::LOCK_LOG_FILE,
+ logging::DELETE_OLD_LOG_FILE,
+ logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+#else // !defined(NDEBUG)
+ // Write logs to a file in debug build.
+ FilePath debug_log = remoting::GetConfigDir().
+ Append(FILE_PATH_LITERAL("debug.log"));
+ logging::InitLogging(
+ debug_log.value().c_str(),
+ logging::LOG_ONLY_TO_FILE,
+ logging::LOCK_LOG_FILE,
+ logging::DELETE_OLD_LOG_FILE,
+ logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+#endif // !defined(NDEBUG)
+
+ // Enable trace control and transport through event tracing for Windows.
+ logging::LogEventProvider::Initialize(kRemotingHostLogProvider);
+}
+
+} // namespace remoting