Sha256: bfd3fe6c520959409daaf9ef8dfaaa880bdf74c7eb985393cedc608e3df13f46

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 Bytes

Contents

# -*- coding: binary -*-
module Rex
module Logging
module Sinks

###
#
# This class implements the LogSink interface and backs it against stderr
###
class Stderr

	include Rex::Logging::LogSink

	#
	# Writes log data to stderr
	#

	def log(sev, src, level, msg, from) # :nodoc:
		if (sev == LOG_RAW)
			$stderr.write(msg)
		else
			code = 'i'

			case sev
				when LOG_DEBUG
					code = 'd'
				when LOG_ERROR
					code = 'e'
				when LOG_INFO
					code = 'i'
				when LOG_WARN
					code = 'w'
			end
			$stderr.write("[#{get_current_timestamp}] [#{code}(#{level})] #{src}: #{msg}\n")
		end
			
		$stderr.flush
	end

protected

end

end end end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/logging/sinks/stderr.rb
librex-0.0.66 lib/rex/logging/sinks/stderr.rb