未验证 提交 3ed7c586 编写于 作者: R Rafael França 提交者: Rafael Mendonça França

Merge pull request #38690 from abhaynikam/38685-add-option-to-disable-sql-color

Disable colorize logging of SQL and reduce unnecessary invocation of sql_color matching
上级 2fa37f9a
......@@ -40,7 +40,7 @@ def sql(event)
end
name = colorize_payload_name(name, payload[:name])
sql = color(sql, sql_color(sql), true)
sql = color(sql, sql_color(sql), true) if colorize_logging
debug " #{name} #{sql}#{binds}"
end
......
......@@ -96,6 +96,16 @@ def test_basic_query_logging_coloration
end
end
def test_logging_sql_coloration_disabled
logger = TestDebugLogSubscriber.new
logger.colorize_logging = false
SQL_COLORINGS.each do |verb, color_regex|
logger.sql(Event.new(0.9, sql: verb.to_s))
assert_no_match(/#{REGEXP_BOLD}#{color_regex}#{verb}#{REGEXP_CLEAR}/i, logger.debugs.last)
end
end
def test_basic_payload_name_logging_coloration_generic_sql
logger = TestDebugLogSubscriber.new
logger.colorize_logging = true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册