2023-09-02 07:07:34 +08:00
|
|
|
from git_command import GetEventTargetPath
|
2023-08-22 09:20:32 +08:00
|
|
|
from git_command import RepoSourceVersion
|
2023-09-02 07:07:34 +08:00
|
|
|
from git_trace2_event_log_base import BaseEventLog
|
2020-12-24 02:08:20 +08:00
|
|
|
|
|
|
|
|
2023-09-02 07:07:34 +08:00
|
|
|
class EventLog(BaseEventLog):
|
2023-03-11 14:46:20 +08:00
|
|
|
"""Event log that records events that occurred during a repo invocation.
|
2021-03-17 05:24:14 +08:00
|
|
|
|
2023-03-11 14:46:20 +08:00
|
|
|
Events are written to the log as a consecutive JSON entries, one per line.
|
|
|
|
Entries follow the git trace2 EVENT format.
|
2021-07-29 05:36:49 +08:00
|
|
|
|
2023-03-11 14:46:20 +08: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-06 03:04:49 +08:00
|
|
|
|
2023-03-11 14:46:20 +08:00
|
|
|
Valid 'event' names and event specific fields are documented here:
|
|
|
|
https://git-scm.com/docs/api-trace2#_event_format
|
2021-03-06 03:04:49 +08:00
|
|
|
"""
|
2021-09-28 01:55:44 +08:00
|
|
|
|
2023-09-02 07:07:34 +08:00
|
|
|
def __init__(self, **kwargs):
|
|
|
|
super().__init__(repo_source_version=RepoSourceVersion(), **kwargs)
|
2023-03-11 14:46:20 +08:00
|
|
|
|
2023-09-02 07:07:34 +08:00
|
|
|
def Write(self, path=None, **kwargs):
|
2023-03-11 14:46:20 +08:00
|
|
|
if path is None:
|
|
|
|
path = self._GetEventTargetPath()
|
2023-09-02 07:07:34 +08:00
|
|
|
return super().Write(path=path, **kwargs)
|
2023-03-11 14:46:20 +08:00
|
|
|
|
2023-09-02 07:07:34 +08:00
|
|
|
def _GetEventTargetPath(self):
|
|
|
|
return GetEventTargetPath()
|