Exemple #1
0
 def test_event_logs(self):
     self.assertEqual(set(s.name for s in event_logs.event_logs()),
                      set(r.name for r in self.registry_root.keys()))
     self.assertTrue(
         all(
             isinstance(s, event_logs.EventLog)
             for s in event_logs.event_logs()))
Exemple #2
0
 def test_event_log_from_event_log(self):
     for l in event_logs.event_logs():
         self.assertTrue(isinstance(l, event_logs.EventLog))
         self.assertTrue(event_logs.event_log(l) is l)
         break
Exemple #3
0
 def test_event_logs(self):
     self.assertEqual(
         set(s.name for s in event_logs.event_logs()),
         set(r.name for r in self.registry_root.keys())
     )
     self.assertTrue(all(isinstance(s, event_logs.EventLog) for s in event_logs.event_logs()))
Exemple #4
0
 def test_event_log_from_event_log(self):
     for l in event_logs.event_logs():
         self.assertTrue(isinstance(l, event_logs.EventLog))
         self.assertTrue(event_logs.event_log(l) is l)
         break
Exemple #5
0
from __future__ import with_statement
import os
import csv
from winsys import dialogs, event_logs

log_name, filename = dialogs.dialog(
    "Write event log to csv",
    ("Event log", list(event_logs.event_logs())),
    ("CSV filename", ""),
)

namer = event_logs.EVENTLOG_TYPE.name_from_value
with open(filename, "wb") as f:
    csv.writer(f).writerows(
        (e.time_generated, e.source_name, namer(e.event_type), e.message)
        for e in event_logs.event_log(log_name))

os.startfile(filename)
Exemple #6
0
from __future__ import with_statement
import os
import csv
from winsys import dialogs, event_logs

log_name, filename = dialogs.dialog(
    "Write event log to csv",
    ("Event log", list(event_logs.event_logs())),
    ("CSV filename", ""),
)

namer = event_logs.EVENTLOG_TYPE.name_from_value
with open(filename, "wb") as f:
    csv.writer(f).writerows(
        (e.time_generated, e.source_name, namer(e.event_type), e.message)
            for e in event_logs.event_log(log_name)
    )

os.startfile(filename)
Exemple #7
0
from winsys import event_logs

for log in event_logs.event_logs():
    print log
    for n_event, event in enumerate(reversed(log)):
        if n_event == 10: break
        print event.time_generated, event

    print