2023-09-01 23:07:34 +00:00
|
|
|
from git_command import GetEventTargetPath
|
2023-08-22 01:20:32 +00:00
|
|
|
from git_command import RepoSourceVersion
|
2023-09-01 23:07:34 +00:00
|
|
|
from git_trace2_event_log_base import BaseEventLog
|
2020-12-23 18:08:20 +00:00
|
|
|
|
|
|
|
|
2023-09-01 23:07:34 +00:00
|
|
|
class EventLog(BaseEventLog):
|
2023-03-11 06:46:20 +00:00
|
|
|
"""Event log that records events that occurred during a repo invocation.
|
2021-03-16 21:24:14 +00:00
|
|
|
|
2023-03-11 06:46:20 +00:00
|
|
|
Events are written to the log as a consecutive JSON entries, one per line.
|
|
|
|
Entries follow the git trace2 EVENT format.
|
2021-07-28 21:36:49 +00:00
|
|
|
|
2023-03-11 06:46:20 +00:00
|
|
|
Each entry contains the following common keys:
|
|
|
|
- event: The event name
|
|
|
|
- sid: session-id - Unique string to allow process instance to be
|
|
|
|
identified.
|
|
|
|
- thread: The thread name.
|
|
|
|
- time: is the UTC time of the event.
|
2021-03-05 19:04:49 +00:00
|
|
|
|
2023-03-11 06:46:20 +00:00
|
|
|
Valid 'event' names and event specific fields are documented here:
|
|
|
|
https://git-scm.com/docs/api-trace2#_event_format
|
2021-03-05 19:04:49 +00:00
|
|
|
"""
|
2021-09-27 17:55:44 +00:00
|
|
|
|
2023-09-01 23:07:34 +00:00
|
|
|
def __init__(self, **kwargs):
|
|
|
|
super().__init__(repo_source_version=RepoSourceVersion(), **kwargs)
|
2023-03-11 06:46:20 +00:00
|
|
|
|
2023-09-01 23:07:34 +00:00
|
|
|
def Write(self, path=None, **kwargs):
|
2023-03-11 06:46:20 +00:00
|
|
|
if path is None:
|
|
|
|
path = self._GetEventTargetPath()
|
2023-09-01 23:07:34 +00:00
|
|
|
return super().Write(path=path, **kwargs)
|
2023-03-11 06:46:20 +00:00
|
|
|
|
2023-09-01 23:07:34 +00:00
|
|
|
def _GetEventTargetPath(self):
|
|
|
|
return GetEventTargetPath()
|