fix: Always log to stderr by default (#1350)
This tweaks the default config for stderrthreshold from absl/log so that we always get logs to stderr by default, as we did in v2. The --quiet and --v flags that existed in v2 can still be used to modify the log level, as well as the new --minloglevel from absl/log. Issue #1325
This commit is contained in:
parent
89376d3c4d
commit
35c2f46428
|
@ -31,6 +31,9 @@ ABSL_FLAG(std::string,
|
||||||
"",
|
"",
|
||||||
"Packager version for testing. Should be used for testing only.");
|
"Packager version for testing. Should be used for testing only.");
|
||||||
|
|
||||||
|
// From absl/log:
|
||||||
|
ABSL_DECLARE_FLAG(int, stderrthreshold);
|
||||||
|
|
||||||
namespace shaka {
|
namespace shaka {
|
||||||
namespace {
|
namespace {
|
||||||
const char kUsage[] =
|
const char kUsage[] =
|
||||||
|
@ -109,6 +112,13 @@ int MpdMain(int argc, char** argv) {
|
||||||
|
|
||||||
auto usage = absl::StrFormat(kUsage, argv[0]);
|
auto usage = absl::StrFormat(kUsage, argv[0]);
|
||||||
absl::SetProgramUsageMessage(usage);
|
absl::SetProgramUsageMessage(usage);
|
||||||
|
|
||||||
|
// Before parsing the command line, change the default value of some flags
|
||||||
|
// provided by libraries.
|
||||||
|
|
||||||
|
// Always log to stderr. Log levels are still controlled by --minloglevel.
|
||||||
|
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||||
|
|
||||||
absl::ParseCommandLine(argc, argv);
|
absl::ParseCommandLine(argc, argv);
|
||||||
|
|
||||||
if (absl::GetFlag(FLAGS_licenses)) {
|
if (absl::GetFlag(FLAGS_licenses)) {
|
||||||
|
|
|
@ -58,6 +58,9 @@ ABSL_FLAG(bool,
|
||||||
false,
|
false,
|
||||||
"If enabled, only use one thread when generating content.");
|
"If enabled, only use one thread when generating content.");
|
||||||
|
|
||||||
|
// From absl/log:
|
||||||
|
ABSL_DECLARE_FLAG(int, stderrthreshold);
|
||||||
|
|
||||||
namespace shaka {
|
namespace shaka {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -560,6 +563,12 @@ int PackagerMain(int argc, char** argv) {
|
||||||
auto usage = absl::StrFormat(kUsage, argv[0]);
|
auto usage = absl::StrFormat(kUsage, argv[0]);
|
||||||
absl::SetProgramUsageMessage(usage);
|
absl::SetProgramUsageMessage(usage);
|
||||||
|
|
||||||
|
// Before parsing the command line, change the default value of some flags
|
||||||
|
// provided by libraries.
|
||||||
|
|
||||||
|
// Always log to stderr. Log levels are still controlled by --minloglevel.
|
||||||
|
absl::SetFlag(&FLAGS_stderrthreshold, 0);
|
||||||
|
|
||||||
auto remaining_args = absl::ParseCommandLine(argc, argv);
|
auto remaining_args = absl::ParseCommandLine(argc, argv);
|
||||||
if (absl::GetFlag(FLAGS_licenses)) {
|
if (absl::GetFlag(FLAGS_licenses)) {
|
||||||
for (const char* line : kLicenseNotice)
|
for (const char* line : kLicenseNotice)
|
||||||
|
|
Loading…
Reference in New Issue