Skip to content

Commit

Permalink
Disable verbose logging by default (microsoft#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMcPMS authored May 7, 2020
1 parent afe95d9 commit 2f4c511
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/AppInstallerCLICore/Argument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ namespace AppInstaller::CLI
return Argument{ "plain", None, Args::Type::PlainStyle, Resources::GetInstance().ResolveWingetString(L"PlainArgumentDescription").c_str(), ArgumentType::Flag, Visibility::Hidden };
case Args::Type::Force:
return Argument{ "force", None, Args::Type::Force, Resources::GetInstance().ResolveWingetString(L"ForceArgumentDescription").c_str(), ArgumentType::Flag };
case Args::Type::VerboseLogs:
return Argument{ "verbose-logs", None, Args::Type::VerboseLogs, Resources::GetInstance().ResolveWingetString(L"VerboseLogsArgumentDescription").c_str(), ArgumentType::Flag };
default:
THROW_HR(E_UNEXPECTED);
}
Expand All @@ -87,5 +89,6 @@ namespace AppInstaller::CLI
args.push_back(ForType(Args::Type::NoVT));
args.push_back(ForType(Args::Type::RainbowStyle));
args.push_back(ForType(Args::Type::PlainStyle));
args.push_back(ForType(Args::Type::VerboseLogs));
}
}
10 changes: 9 additions & 1 deletion src/AppInstallerCLICore/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace AppInstaller::CLI
// Set output to UTF8
ConsoleOuputCPRestore utf8CP(CP_UTF8);

// Enable logging (*all* for now, TODO: add common arguments to allow control of logging)
// Enable all logging for this phase; we will update once we have the arguments
Logging::Log().EnableChannel(Logging::Channel::All);
Logging::Log().SetLevel(Logging::Level::Verbose);
Logging::AddFileLogger();
Expand Down Expand Up @@ -88,7 +88,15 @@ namespace AppInstaller::CLI
Logging::Telemetry().LogCommand(command->FullName());

command->ParseArguments(invocation, context.Args);

// Change logging level to Info if Verbose not requested
if (!context.Args.Contains(Execution::Args::Type::VerboseLogs))
{
Logging::Log().SetLevel(Logging::Level::Info);
}

context.UpdateForArgs();

command->ValidateArguments(context.Args);
}
// Exceptions specific to parsing the arguments of a command
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/ExecutionArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace AppInstaller::CLI::Execution
RainbowStyle, // Makes progress display as a rainbow
Help, // Show command usage
Info, // Show general info about WinGet
VerboseLogs, // Increases winget logging level to verbose
};

bool Contains(Type arg) const { return (m_parsedArgs.count(arg) != 0); }
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@
<data name="ValidateManifestArgumentDescription" xml:space="preserve">
<value>The path to the manifest to be validated</value>
</data>
<data name="VerboseLogsArgumentDescription" xml:space="preserve">
<value>Enables verbose logging for WinGet</value>
</data>
<data name="VersionArgumentDescription" xml:space="preserve">
<value>Use the specified version; default is the latest version</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerRepositoryCore/SQLiteWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace AppInstaller::Repository::SQLite

void Connection::EnableICU()
{
AICLI_LOG(SQL, Info, << "Enabling ICU");
AICLI_LOG(SQL, Verbose, << "Enabling ICU");
THROW_IF_SQLITE_FAILED(sqlite3IcuInit(m_dbconn.get()));
}

Expand Down

0 comments on commit 2f4c511

Please sign in to comment.