Method: Puppet::Util::Log.create

Defined in:
lib/puppet/util/log.rb

.create(hash) ⇒ Object

Create a new log message. The primary role of this method is to avoid creating log messages below the loglevel.

Raises:



85
86
87
88
89
90
# File 'lib/puppet/util/log.rb', line 85

def Log.create(hash)
  raise Puppet::DevError, _("Logs require a level") unless hash.include?(:level)
  raise Puppet::DevError, _("Invalid log level %{level}") % { level: hash[:level] } unless @levels.index(hash[:level])

  @levels.index(hash[:level]) >= @loglevel ? Puppet::Util::Log.new(hash) : nil
end