プロジェクト

全般

プロフィール

Vote #75831

完了

Wrong usage of logger.info to test log level

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
80
issue_org_id:
18605
author_id:
36999
assigned_to_id:
1
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

logger.info (instead of logger.info?) can trigger an error

Line 185 :

logger.info "time entry could not be updated: #{time_entry.errors.full_messages}" if logger && logger.info

replace by :

logger.info "time entry could not be updated: #{time_entry.errors.full_messages}" if logger && logger.info?

journals

Sorry I missed a closing pre Tag !
--------------------------------------------------------------------------------
Jérôme BATAILLE wrote:
> logger.info (instead of logger.info?) can trigger an error

In which circumstances?
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> In which circumstances?
In fact it can't because nil is managed as the default value.

But logger.info always return true (http://www.ruby-doc.org/stdlib-2.0/libdoc/logger/rdoc/Logger.html#method-i-add), so you can't use logger.info to detect if info level is enabled.

--------------------------------------------------------------------------------
Fixed in r13766 with another one, thanks.
--------------------------------------------------------------------------------
Thanks a lot again ! :-)
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン3.0.0_80 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0