Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
avoid setting log levels if unneccessary
Browse files Browse the repository at this point in the history
and make a note of why it's necessary.
  • Loading branch information
ccutrer committed Nov 27, 2022
1 parent 66cdc82 commit 5b29462
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/openhab/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,19 @@ def inspect
alias_method :to_s, :inspect

# @!attribute [rw] level
#
# @note When a logger's level is modified, the logging infrastructure has
# to reload, and logging may be completely unavailable for a short time.
#
# @return [:error,:warn,:info,:debug,:trace] The current log level
#
def level
Logger.log_service.get_level(name)[name]&.downcase&.to_sym
end

def level=(level)
return if self.level == level

Logger.log_service.set_level(name, level.to_s)
end

Expand Down

0 comments on commit 5b29462

Please sign in to comment.