Mojo::Log::Role::Color - Add colors to your mojo logs
use Mojo::Log; my $log = Mojo::Log->with_roles("+Color")->new; $log->info("FYI: it happened again");
It is also possible to set the
MOJO_LOG_COLORS environment variable to force colored output.
The coloring is based on the log level:
debug: cyan text info: green text warn: yellow text error: red text fatal: white text on red background
The colors can be customized by changing
%Mojo::Log::Role::Color::COLORS, though this is not officially supported, and may break in a future release.
$bool = $log->colored; $log = $log->colored(1);
Check if colored output is enabled, or force it to a given state. Defaults to
MOJO_LOG_COLORS environment variable, or will be set to "1" if "handle" in Mojo::Log is attached to a terminal.
Jan Henning Thorsen
Copyright (C) Jan Henning Thorsen
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.