CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/logging/sinks/stdout_without_timestamps.rb
Views: 1904
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