Don't log unknown commands
MODIFY
src/vcpkg.cpp
src/vcpkg.cpp
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/files.h>
+#include <vcpkg/base/hash.h>
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.debug.h>
@@ -74,7 +75,6 @@ static void invalid_command(const std::string& cmd)
static void inner(vcpkg::Filesystem& fs, const VcpkgCmdArguments& args)
{
- LockGuardPtr<Metrics>(g_metrics)->track_property("command", args.command);
if (args.command.empty())
{
print_usage();
@@ -98,6 +98,7 @@ static void inner(vcpkg::Filesystem& fs, const VcpkgCmdArguments& args)
if (const auto command_function = find_command(Commands::get_available_basic_commands()))
{
+ LockGuardPtr<Metrics>(g_metrics)->track_property("command_name", command_function->name);
return command_function->function->perform_and_exit(args, fs);
}
@@ -108,6 +109,7 @@ static void inner(vcpkg::Filesystem& fs, const VcpkgCmdArguments& args)
if (const auto command_function = find_command(Commands::get_available_paths_commands()))
{
+ LockGuardPtr<Metrics>(g_metrics)->track_property("command_name", command_function->name);
return command_function->function->perform_and_exit(args, paths);
}
@@ -118,6 +120,7 @@ static void inner(vcpkg::Filesystem& fs, const VcpkgCmdArguments& args)
if (const auto command_function = find_command(Commands::get_available_triplet_commands()))
{
+ LockGuardPtr<Metrics>(g_metrics)->track_property("command_name", command_function->name);
return command_function->function->perform_and_exit(args, paths, default_triplet, host_triplet);
}

Don't log unknown commands (#259)