Reputation: 4654
Output of tail logs/development.log
in XFCE Terminal:
multitail log/development.log
Rails adds escape codes to log files automatically. See development.log
file:
^[[1m^[[36m (84.1ms)^[[0m ^[[1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) ^[[0m
^[[1m^[[35m (92.6ms)^[[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
^[[1m^[[36m (0.2ms)^[[0m ^[[1mSELECT version FROM "schema_migrations"^[[0m
^[[1m^[[35m (159.3ms)^[[0m INSERT INTO "schema_migrations" (version) VALUES ('20130327221553')
^[[1m^[[36m (59.9ms)^[[0m ^[[1mINSERT INTO "schema_migrations" (version) VALUES ('20130326152730')^[[0m
^[[1m^[[35m (59.8ms)^[[0m INSERT INTO "schema_migrations" (version) VALUES ('20130327173637')
multitail -c
produce non-usable output.
How to colorize logs in Multitail without writing own color scheme?
Upvotes: 23
Views: 5729
Reputation: 4654
It's all about interpreting ANSI escape sequences which does terminal not tail
itself and have to do multitail
as well.
It can be done with -cT ANSI
option:
-cT term interpret terminal-codes from file/command (for terminal type 'term')
Example:
$ multitail -cT ansi log/development.log
multiple files:
$ multitail -cT ansi log/development.log -cT ANSI log/test.log
Upvotes: 45