Sha256: b406321714407f681ad78bef4c2c4dad2a0db5cbdc3d14c459ac8854e02651ff

Contents?: true

Size: 619 Bytes

Versions: 43

Compression:

Stored size: 619 Bytes

Contents

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

43 entries across 43 versions & 1 rubygems

Version Path
librex-0.0.4 lib/rex/logging/sinks/stderr.rb
librex-0.0.3 lib/rex/logging/sinks/stderr.rb
librex-0.0.1 lib/rex/logging/sinks/stderr.rb