From 15f59b54dd25c97136207ccd927511c379f7741a Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Wed, 25 Mar 2015 17:51:56 +0530
Subject: [PATCH] allow setting loglevel

---
 atom/app/atom_main_delegate.cc           |  6 ++++--
 docs/api/chrome-command-line-switches.md | 27 ++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc
index 9f86bbb57f11..5e383088638d 100644
--- a/atom/app/atom_main_delegate.cc
+++ b/atom/app/atom_main_delegate.cc
@@ -27,8 +27,8 @@ AtomMainDelegate::~AtomMainDelegate() {
 
 bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
   // Disable logging out to debug.log on Windows
-#if defined(OS_WIN)
   logging::LoggingSettings settings;
+#if defined(OS_WIN)
 #if defined(DEBUG)
   settings.logging_dest = logging::LOG_TO_ALL;
   settings.log_file = L"debug.log";
@@ -37,9 +37,11 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
 #else
   settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
 #endif
-  logging::InitLogging(settings);
 #endif  // defined(OS_WIN)
 
+  // allows setting loglevel --v or --vmodule
+  logging::InitLogging(settings);
+
   // Logging with pid and timestamp.
   logging::SetLogItems(true, false, true, false);
 
diff --git a/docs/api/chrome-command-line-switches.md b/docs/api/chrome-command-line-switches.md
index d17e7a9cd9b6..e5ff685a6908 100644
--- a/docs/api/chrome-command-line-switches.md
+++ b/docs/api/chrome-command-line-switches.md
@@ -61,3 +61,30 @@ Like `--host-rules` but these `rules` only apply to the host resolver.
 ## --ignore-certificate-errors
 
 Ignore certificate related errors.
+
+## --v=`log_level`
+
+Gives the default maximal active V-logging level; 0 is the default.
+Normally positive values are used for V-logging levels.
+
+-1 to disable logs
+
+## --vmodule=`pattern`
+
+Gives the per-module maximal V-logging levels to override the value
+given by --v.  E.g. "my_module=2,foo*=3" would change the logging
+level for all code in source files "my_module.*" and "foo*.*"
+("-inl" suffixes are also disregarded for this matching).
+
+Any pattern containing a forward or backward slash will be tested
+against the whole pathname and not just the module.  E.g.,
+"*/foo/bar/*=2" would change the logging level for all code in
+source files under a "foo/bar" directory.
+
+For example to disable all chromium related logs and only enable
+your application logs
+
+```
+app.commandLine.appendSwitch('v', -1);
+app.commandLine.appendSwitch('vmodule', 'console=0');
+```