-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
The current logging implementation in powershell is tightly coupled to ETW requiring callers to have direct and unnecessary knowledge of each ETW event, including meta data such as task, opcode, and channel,
Ideally, this interface should be generalized to a simple 'log id' and parameters as well as a general purpose log message api and completely hide the ETW details.
NOTE: For ETW, the additional meta data is already encapsulated in the EventDescriptor and requiring callers to pass it is redundant, at best, or error prone, at worse.
The refactor should move the ETW semantics down into the LogProvider implementation, refactor PSEtwLog into a logging class and support alternatives, such as syslog.
Additionally, the refactor should have a single point of entry for logging an event; whether it be ETW, Syslog or another output type. As it stands, PowerShell code contains 3 different places where events are raised and, in one case, it fabricates event descriptors on the fly. This is fragile to maintain.
Any event specific data (such as message strings, channels, etc.) can be obtained through code generators and consumed by the underlying loggers versus requiring powershell-proper to have knowledge of it.