CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/logging/sinks/stdout_without_timestamps.rb
Views: 11784
1
# -*- coding: binary -*-
2
3
4
module Rex
5
module Logging
6
module Sinks
7
8
###
9
#
10
# This class implements the LogSink interface and backs it against stdout
11
###
12
class StdoutWithoutTimestamps < Rex::Logging::Sinks::Stream
13
14
#
15
# Creates a log sink instance that will be configured to log to stdout
16
#
17
def initialize(*_attrs)
18
super($stdout)
19
end
20
21
#
22
# Writes log data to a stream
23
#
24
#
25
# Writes log data to a stream
26
#
27
def log(sev, src, level, msg) # :nodoc:
28
if sev == LOG_RAW
29
stream.write(msg)
30
else
31
stream.write("[#{log_code_for(sev)}(#{level})] #{src}: #{msg}\n")
32
end
33
34
stream.flush
35
end
36
37
end
38
39
end end end
40
41