Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: mojo/logging/init_logging.cc

Issue 2008383002: Remove a bunch of stuff in //mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/logging/init_logging.h ('k') | mojo/mojo_base.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/logging/init_logging.h"
6
7 #include "base/command_line.h"
8 #include "base/logging.h"
9
10 namespace mojo {
11 namespace {
12
13 ::logging::LoggingDestination DetermineLogMode(
14 const base::CommandLine& command_line) {
15 // only use OutputDebugString in debug mode
16 #if defined(NDEBUG)
17 bool enable_logging = false;
18 const char* kInvertLoggingSwitch = "enable-logging";
19 #else
20 bool enable_logging = true;
21 const char* kInvertLoggingSwitch = "disable-logging";
22 #endif
23 const ::logging::LoggingDestination kDefaultLoggingMode =
24 ::logging::LOG_TO_SYSTEM_DEBUG_LOG;
25
26 if (command_line.HasSwitch(kInvertLoggingSwitch))
27 enable_logging = !enable_logging;
28
29 return enable_logging ? kDefaultLoggingMode : ::logging::LOG_NONE;
30 }
31
32 } // namespace
33
34 void InitLogging() {
35 ::logging::LoggingSettings settings;
36 settings.logging_dest = DetermineLogMode(
37 *base::CommandLine::ForCurrentProcess());
38 ::logging::InitLogging(settings);
39
40 // we want process and thread IDs because we have a lot of things running
41 ::logging::SetLogItems(true, // enable_process_id
42 true, // enable_thread_id
43 true, // enable_timestamp
44 false); // enable_tickcount
45 }
46
47 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/logging/init_logging.h ('k') | mojo/mojo_base.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698