ruby-on-rails – 如何告诉ActiveRecord不要记录任何控制字符

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 如何告诉ActiveRecord不要记录任何控制字符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_404_0@
是否有任何方法可以告诉活动记录在记录日志时不记录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

猜你在找的Ruby相关文章