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.65 lib/rex/logging/sinks/stderr.rb
librex-0.0.63 lib/rex/logging/sinks/stderr.rb
librex-0.0.54 lib/rex/logging/sinks/stderr.rb
librex-0.0.53 lib/rex/logging/sinks/stderr.rb
librex-0.0.52 lib/rex/logging/sinks/stderr.rb
librex-0.0.51 lib/rex/logging/sinks/stderr.rb
librex-0.0.50 lib/rex/logging/sinks/stderr.rb
librex-0.0.49 lib/rex/logging/sinks/stderr.rb
librex-0.0.48 lib/rex/logging/sinks/stderr.rb
librex-0.0.47 lib/rex/logging/sinks/stderr.rb
librex-0.0.46 lib/rex/logging/sinks/stderr.rb
librex-0.0.44 lib/rex/logging/sinks/stderr.rb
librex-0.0.43 lib/rex/logging/sinks/stderr.rb
librex-0.0.42 lib/rex/logging/sinks/stderr.rb
librex-0.0.41 lib/rex/logging/sinks/stderr.rb
librex-0.0.40 lib/rex/logging/sinks/stderr.rb
librex-0.0.39 lib/rex/logging/sinks/stderr.rb
librex-0.0.38 lib/rex/logging/sinks/stderr.rb
librex-0.0.37 lib/rex/logging/sinks/stderr.rb
librex-0.0.36 lib/rex/logging/sinks/stderr.rb