是否有任何方法可以告诉活动记录在记录日志时不记录ansi颜色代码?
例如.我不希望这在我的日志中.
[4;36;1msql (0.1ms)[0m [0;1mSELECT count(*) AS count_all FROM `users` WHERE (`user`.id = 133) [0m
相反,我想要这个:
sql (0.1ms) SELECT count(*) AS count_all FROM `users` WHERE (`user`.id = 133)
事实上,我并不是在寻找一种能够清理混乱的解决方案.
解决方法
回答Rails 3:
config.colorize_logging = false
见http://guides.rubyonrails.org/3_0_release_notes.html
ActiveRecord::Base.colorize_logging and config.active_record.colorize_logging are deprecated in favor of Rails::LogSubscriber.colorize_logging or config.colorize_logging