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/log_sink.rb
Views: 11777
1
# -*- coding: binary -*-
2
3
module Rex
4
module Logging
5
6
###
7
#
8
# This abstract interface is what must be implemented by any class
9
# that would like to register as a log sink on a given LogDispatcher
10
# instance, such as the Framework object.
11
#
12
###
13
module LogSink
14
15
def cleanup
16
end
17
18
#
19
# This method must be implemented by any derived log sink classes and is
20
# intended to take the supplied parameters and persist them to an arbitrary
21
# medium.
22
#
23
def log(sev, src, level, msg)
24
raise NotImplementedError
25
end
26
27
protected
28
29
#
30
# This method returns the current timestamp in MM/DD/YYYY HH:Mi:SS format.
31
#
32
def get_current_timestamp
33
return ::Time.now.strftime("%m/%d/%Y %H:%M:%S")
34
end
35
36
end
37
38
end
39
end
40
41