gpt4 book ai didi

activerecord - 如何使用 Active Record 在 Sinatra 中静音 SQLite3 记录器?

转载 作者:IT王子 更新时间:2023-10-29 06:28:06 25 4
gpt4 key购买 nike

guard 输出窗口填满

D, [2012-11-19T18:36:30.391459 #53057] DEBUG -- :    (0.1ms)  begin transaction
D, [2012-11-19T18:36:30.392668 #53057] DEBUG -- : SQL (0.4ms) INSERT INTO "foo" ("created_at", "id", "foo", "foo", "updated_at", "value") VALUES (?, ?, ?, ?, ?, ?) [["created_at", 2012-11-19 18:36:30 -0800], ["id", 4], ["bar", 2], ["foo", 12], ["updated_at", 2012-11-19 18:36:30 -0800], ["value", true]]
D, [2012-11-19T18:36:30.393572 #53057] DEBUG -- : (0.7ms) commit transaction

如何关闭这个输出?

我尝试了 ActiveRecord::Base.logger = nil,但这似乎没有任何作用。

使用 sinatra-activerecordrspecguard

最佳答案

ActiveRecord::Base.logger.level = 1

任何值为 1 或更大的值都有效。我想它也适用于其他数据库。

Reference

关于activerecord - 如何使用 Active Record 在 Sinatra 中静音 SQLite3 记录器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13465842/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com