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:
Joey Parrish 2024-02-23 16:16:29 -08:00 committed by GitHub
parent 89376d3c4d
commit 35c2f46428
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -31,6 +31,9 @@ ABSL_FLAG(std::string,
"",
"Packager version for testing. Should be used for testing only.");
// From absl/log:
ABSL_DECLARE_FLAG(int, stderrthreshold);
namespace shaka {
namespace {
const char kUsage[] =
@ -109,6 +112,13 @@ int MpdMain(int argc, char** argv) {
auto usage = absl::StrFormat(kUsage, argv[0]);
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);
if (absl::GetFlag(FLAGS_licenses)) {

View File

@ -58,6 +58,9 @@ ABSL_FLAG(bool,
false,
"If enabled, only use one thread when generating content.");
// From absl/log:
ABSL_DECLARE_FLAG(int, stderrthreshold);
namespace shaka {
namespace {
@ -560,6 +563,12 @@ int PackagerMain(int argc, char** argv) {
auto usage = absl::StrFormat(kUsage, argv[0]);
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);
if (absl::GetFlag(FLAGS_licenses)) {
for (const char* line : kLicenseNotice)