/// <summary> /// Initializes a new instance of the <see cref="EventLogConfig"/> class. /// </summary> /// <param name="logInclusionKindToOriginsMap">The log-item origins to log for.</param> /// <param name="source">Optional event log source; DEFAULT is running process' name.</param> /// <param name="shouldCreateSourceIfMissing">Value indicating whether or not to create the source if missing.</param> /// <param name="logName">Optional log name; DEFAULT is <see cref="DefaultLogName" />.</param> /// <param name="machineName">Optional machine name; DEFAULT is <see cref="DefaultMachineName" />.</param> /// <param name="logItemPropertiesToIncludeInLogMessage"> The properties/aspects of a <see cref="LogItem"/> to include when building a log message.</param> public EventLogConfig( IReadOnlyDictionary <LogItemKind, IReadOnlyCollection <string> > logInclusionKindToOriginsMap, string source = null, string logName = DefaultLogName, string machineName = DefaultMachineName, bool shouldCreateSourceIfMissing = false, LogItemPropertiesToIncludeInLogMessage logItemPropertiesToIncludeInLogMessage = LogItemPropertiesToIncludeInLogMessage.Default) : base(logInclusionKindToOriginsMap, logItemPropertiesToIncludeInLogMessage) { this.Source = string.IsNullOrWhiteSpace(source) ? ProcessHelpers.GetRunningProcess().GetName() : source; this.ShouldCreateSourceIfMissing = shouldCreateSourceIfMissing; this.LogName = string.IsNullOrWhiteSpace(logName) ? DefaultLogName : logName; this.MachineName = string.IsNullOrWhiteSpace(machineName) ? DefaultMachineName : machineName; }
static LogHelper() { MachineName = Diagnostics.Recipes.MachineName.GetMachineName(); ProcessName = ProcessHelpers.GetRunningProcess().GetName(); ProcessFileVersion = ProcessHelpers.GetRunningProcess().GetFileVersion(); }