laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 31 forks source link

Add timestamps to Command output #2646

Open jelib3an opened 3 years ago

jelib3an commented 3 years ago

Similar to https://github.com/laravel/framework/pull/37591

I've been adding this trait to my commands so all outputs have timestamps on them. I find it helpful in logs or for debugging long running scripts.

trait TimestamppedOutputTrait
{
    public function line($string, $style = null, $verbosity = null)
    {
        $string = now()->format("[Y-m-d H:i:s] ").$string;
        return parent::line($string, $style, $verbosity);
    }
}

Curious, would others find this useful if it were added to laravel/framework or laravel/laravel?