Enable verbose logging through --v or --vmodule

Change-Id: I36d8d3dd11abe10ce598ef92f38a2a33a15d8f8e
This commit is contained in:
KongQun Yang 2015-10-27 11:52:50 -07:00 committed by Gerrit Code Review
parent 8fc7f51d81
commit cf0db383a3
5 changed files with 57 additions and 0 deletions

View File

@ -5,6 +5,8 @@
// https://developers.google.com/open-source/licenses/bsd
#include "packager/app/mpd_generator_flags.h"
#include "packager/app/vlog_flags.h"
#include "packager/base/command_line.h"
#include "packager/base/logging.h"
#include "packager/base/strings/string_split.h"
#include "packager/base/strings/stringprintf.h"
@ -77,6 +79,10 @@ ExitStatus RunMpdGenerator() {
}
int MpdMain(int argc, char** argv) {
// Needed to enable VLOG/DVLOG through --vmodule or --v.
base::CommandLine::Init(argc, argv);
CHECK(logging::InitLogging(logging::LoggingSettings()));
google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
google::ParseCommandLineFlags(&argc, &argv, true);

View File

@ -13,7 +13,9 @@
#include "packager/app/muxer_flags.h"
#include "packager/app/packager_util.h"
#include "packager/app/stream_descriptor.h"
#include "packager/app/vlog_flags.h"
#include "packager/app/widevine_encryption_flags.h"
#include "packager/base/command_line.h"
#include "packager/base/logging.h"
#include "packager/base/stl_util.h"
#include "packager/base/strings/string_split.h"
@ -310,6 +312,10 @@ bool RunPackager(const StreamDescriptorList& stream_descriptors) {
}
int PackagerMain(int argc, char** argv) {
// Needed to enable VLOG/DVLOG through --vmodule or --v.
base::CommandLine::Init(argc, argv);
CHECK(logging::InitLogging(logging::LoggingSettings()));
google::SetUsageMessage(base::StringPrintf(kUsage, argv[0]));
google::ParseCommandLineFlags(&argc, &argv, true);
if (argc < 2) {

View File

@ -0,0 +1,26 @@
// Copyright 2015 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
//
// Defines verbose logging flags.
#include "packager/app/vlog_flags.h"
DEFINE_int32(v,
0,
"Show all VLOG(m) or DVLOG(m) messages for m <= this. "
"Overridable by --vmodule.");
DEFINE_string(
vmodule,
"",
"Per-module verbose level."
"Argument is a comma-separated list of <module name>=<log level>. "
"<module name> is a glob pattern, matched against the filename base "
"(that is, name ignoring .cc/.h./-inl.h). "
"A pattern without slashes matches just the file name portion, otherwise "
"the whole file path (still without .cc/.h./-inl.h) is matched. "
"? and * in the glob pattern match any single or sequence of characters "
"respectively including slashes. "
"<log level> overrides any value given by --v.");

15
packager/app/vlog_flags.h Normal file
View File

@ -0,0 +1,15 @@
// Copyright 2015 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#ifndef APP_VLOG_FLAGS_H_
#define APP_VLOG_FLAGS_H_
#include <gflags/gflags.h>
DECLARE_int32(v);
DECLARE_string(vmodule);
#endif // APP_VLOG_FLAGS_H_

View File

@ -28,6 +28,8 @@
'app/stream_descriptor.h',
'app/validate_flag.cc',
'app/validate_flag.h',
'app/vlog_flags.cc',
'app/vlog_flags.h',
'app/widevine_encryption_flags.cc',
'app/widevine_encryption_flags.h',
],
@ -51,6 +53,8 @@
'sources': [
'app/mpd_generator.cc',
'app/mpd_generator_flags.h',
'app/vlog_flags.cc',
'app/vlog_flags.h',
],
'dependencies': [
'base/base.gyp:base',