diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-22 10:29:19 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-22 10:29:19 +0900 |
| commit | 2c243a3cb814939bbe40fda1608781825ab0d77d (patch) | |
| tree | cb79b397e19e23b1670ab2ef3766c0c4717637aa /crates/mozart/src/commands.rs | |
| parent | 0a8e5935e6305819bb02d8c69e2f046ff397913a (diff) | |
| download | php-mozart-2c243a3cb814939bbe40fda1608781825ab0d77d.tar.gz php-mozart-2c243a3cb814939bbe40fda1608781825ab0d77d.tar.zst php-mozart-2c243a3cb814939bbe40fda1608781825ab0d77d.zip | |
feat(tracing): add performance profiling via tracing crate
Wire up the existing --profile flag with tracing-subscriber to emit
span timings on stderr. Supports MOZART_LOG env var override and
verbose-level-aware filtering. No subscriber is installed when
--profile is off, keeping tracing macros zero-cost.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands.rs')
| -rw-r--r-- | crates/mozart/src/commands.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crates/mozart/src/commands.rs b/crates/mozart/src/commands.rs index a745b3a..7b94f4d 100644 --- a/crates/mozart/src/commands.rs +++ b/crates/mozart/src/commands.rs @@ -197,6 +197,47 @@ pub enum Commands { Validate(validate::ValidateArgs), } +impl Commands { + pub fn name(&self) -> &'static str { + match self { + Commands::About(_) => "about", + Commands::Archive(_) => "archive", + Commands::Audit(_) => "audit", + Commands::Browse(_) => "browse", + Commands::Bump(_) => "bump", + Commands::CheckPlatformReqs(_) => "check-platform-reqs", + Commands::ClearCache(_) => "clear-cache", + Commands::Completion(_) => "completion", + Commands::Config(_) => "config", + Commands::CreateProject(_) => "create-project", + Commands::Depends(_) => "depends", + Commands::Diagnose(_) => "diagnose", + Commands::DumpAutoload(_) => "dump-autoload", + Commands::Exec(_) => "exec", + Commands::Fund(_) => "fund", + Commands::Global(_) => "global", + Commands::Init(_) => "init", + Commands::Install(_) => "install", + Commands::Licenses(_) => "licenses", + Commands::Outdated(_) => "outdated", + Commands::Prohibits(_) => "prohibits", + Commands::Reinstall(_) => "reinstall", + Commands::Remove(_) => "remove", + Commands::Repository(_) => "repository", + Commands::Require(_) => "require", + Commands::RunScript(_) => "run-script", + Commands::Search(_) => "search", + Commands::SelfUpdate(_) => "self-update", + Commands::Show(_) => "show", + Commands::Status(_) => "status", + Commands::Suggests(_) => "suggests", + Commands::Update(_) => "update", + Commands::Validate(_) => "validate", + } + } +} + +#[tracing::instrument(skip(cli), fields(command = cli.command.name()))] pub fn execute(cli: &Cli) -> anyhow::Result<()> { let console = mozart_core::console::Console::new( cli.verbose, |
