ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Add timestamps to Command output

Open jelib3an opened this issue 3 years ago • 0 comments

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?

jelib3an avatar Jun 18 '21 22:06 jelib3an