diff --git a/packager/app/mpd_generator.cc b/packager/app/mpd_generator.cc index 88a46e4f06..b35028df62 100644 --- a/packager/app/mpd_generator.cc +++ b/packager/app/mpd_generator.cc @@ -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); diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index 1d13520682..5c7f53dd57 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -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) { diff --git a/packager/app/vlog_flags.cc b/packager/app/vlog_flags.cc new file mode 100644 index 0000000000..a40f1d1c60 --- /dev/null +++ b/packager/app/vlog_flags.cc @@ -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 =. " + " 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. " + " overrides any value given by --v."); diff --git a/packager/app/vlog_flags.h b/packager/app/vlog_flags.h new file mode 100644 index 0000000000..13c6bdf105 --- /dev/null +++ b/packager/app/vlog_flags.h @@ -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 + +DECLARE_int32(v); +DECLARE_string(vmodule); + +#endif // APP_VLOG_FLAGS_H_ diff --git a/packager/packager.gyp b/packager/packager.gyp index fdbb647c4b..2ab3accc1c 100644 --- a/packager/packager.gyp +++ b/packager/packager.gyp @@ -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',