Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
print >>stdout, when, d.get('num')
return
eid = (d["incarnation"], d["num"])
# let's mark the trigger event from incident reports with
# [INCIDENT-TRIGGER] at the end of the line
is_trigger = bool(self.trigger and (eid == self.trigger))
try:
text = format_message(d)
except:
print "unformattable event", d
raise
t = "%s#%d " % (short, d['num'])
if options['rx-time']:
rx_when = format_time(e['rx_time'], options["timestamps"])
t += "rx(%s) " % rx_when
t += "emit(%s)" % when
else:
t += "%s" % when
t += ": %s" % text
if options['verbose']:
t += ": %r" % d
if is_trigger:
t += " [INCIDENT-TRIGGER]"
print >>stdout, t
if 'failure' in d:
print >>stdout," FAILURE:"
lines = str(d['failure']).split("\n")
for line in lines:
print >>stdout, " %s" % (line,)
def formatted_print(self, d):
time_s = format_time(d['time'], self.options["timestamps"])
msg = log.format_message(d)
level = d.get('level', log.OPERATIONAL)
tubid = "" # TODO
print("%s L%d [%s]#%d %s" % (time_s, level, tubid,
d["num"], msg), file=self.output)
if 'failure' in d:
print(" FAILURE:", file=self.output)
lines = str(d['failure']).split("\n")
for line in lines:
print(" %s" % (line,), file=self.output)
def print_event(self, e, options):
stdout = options.stdout
short = e['from'][:8]
d = e['d']
when = format_time(d['time'], options["timestamps"])
if options['just-numbers']:
print >>stdout, when, d.get('num')
return
eid = (d["incarnation"], d["num"])
# let's mark the trigger event from incident reports with
# [INCIDENT-TRIGGER] at the end of the line
is_trigger = bool(self.trigger and (eid == self.trigger))
try:
text = format_message(d)
except:
print "unformattable event", d
raise
t = "%s#%d " % (short, d['num'])
if options['rx-time']:
def web_format_time(t, mode="short-local"):
time_s = format_time(t, mode)
time_utc = format_time(t, "utc")
time_local = format_time(t, "long-local")
time_ctime = time.ctime(t).replace(" ", " ")
extended = "Local=%s Local=%s UTC=%s" % (time_ctime, time_local, time_utc)
return time_s, extended
def web_format_time(t, mode="short-local"):
time_s = format_time(t, mode)
time_utc = format_time(t, "utc")
time_local = format_time(t, "long-local")
time_ctime = time.ctime(t).replace(" ", " ")
extended = "Local=%s Local=%s UTC=%s" % (time_ctime, time_local, time_utc)
return time_s, extended
def web_format_time(t, mode="short-local"):
time_s = format_time(t, mode)
time_utc = format_time(t, "utc")
time_local = format_time(t, "long-local")
time_ctime = time.ctime(t).replace(" ", " ")
extended = "Local=%s Local=%s UTC=%s" % (time_ctime, time_local, time_utc)
return time_s, extended