private IActionLogWriter[] CreateLogs() { var logs = new IActionLogWriter[Enum.GetValues(typeof(LogVerbosity)).Length]; logs[(int)LogVerbosity.None] = NullLogWriter.Instance; IActionLogWriter mainWriter = NullLogWriter.Instance; if (_permissions.CurrentVerbosity >= LogVerbosity.Minimal) { mainWriter = _writer ?? FileLogWriter.InFolder(Folder, _name); } // Unfortunately, creation of event sources in OS logs requires local admin rights. // http://www.christiano.ch/wordpress/2009/12/02/iis7-web-application-writing-to-event-log-generates-security-exception/ // So we can't use OS event logs as in Dev15 there is no MSI which could elevate.. // _maxLogLevel >= LogLevel.Minimal ? (_writer ?? new ApplicationLogWriter(_name)) : NullLogWriter.Instance; logs[(int)LogVerbosity.Minimal] = mainWriter; logs[(int)LogVerbosity.Normal] = _permissions.CurrentVerbosity >= LogVerbosity.Normal ? mainWriter : NullLogWriter.Instance; if (_permissions.CurrentVerbosity == LogVerbosity.Traffic) { logs[(int)LogVerbosity.Traffic] = _writer ?? FileLogWriter.InFolder(Folder, _name + ".traffic"); } else { logs[(int)LogVerbosity.Traffic] = NullLogWriter.Instance; } return(logs); }
private async Task EnsureCreatedAsync() { var token = await _initializationLock.WaitAsync(); try { if (!token.IsSet) { // Delay-create log since permission is established when settings are loaded // which may happen after ctor is called. _logs = new IActionLogWriter[Enum.GetValues(typeof(LogVerbosity)).Length]; _logs[(int)LogVerbosity.None] = NullLogWriter.Instance; IActionLogWriter mainWriter = NullLogWriter.Instance; if (_permissions.CurrentVerbosity >= LogVerbosity.Minimal) { mainWriter = _writer ?? FileLogWriter.InTempFolder(_appName); } // Unfortunately, creation of event sources in OS logs requires local admin rights. // http://www.christiano.ch/wordpress/2009/12/02/iis7-web-application-writing-to-event-log-generates-security-exception/ // So we can't use OS event logs as in Dev15 there is no MSI which could elevate.. // _maxLogLevel >= LogLevel.Minimal ? (_writer ?? new ApplicationLogWriter(_appName)) : NullLogWriter.Instance; _logs[(int)LogVerbosity.Minimal] = mainWriter; _logs[(int)LogVerbosity.Normal] = _permissions.CurrentVerbosity >= LogVerbosity.Normal ? mainWriter : NullLogWriter.Instance; if (_permissions.CurrentVerbosity == LogVerbosity.Traffic) { _logs[(int)LogVerbosity.Traffic] = _writer ?? FileLogWriter.InTempFolder(_appName + ".traffic"); } else { _logs[(int)LogVerbosity.Traffic] = NullLogWriter.Instance; } } } finally { token.Set(); } }
internal Logger(IActionLogWriter defaultWriter, ILoggingPermissions permissions) { _writer = defaultWriter; _permissions = permissions; _logs = Lazy.Create(CreateLogs); }
internal Logger(string appName, ILoggingPermissions permissions, IActionLogWriter writer) { _appName = appName; _permissions = permissions; _writer = writer; }
private ProjectSystemActionLog(IActionLogWriter logWriter) : base(logWriter) { }
public LinesLog(IActionLogWriter logWriter) : base(logWriter) { }
public StringLog(IActionLogWriter logWriter) { _logWriter = logWriter ?? NullLogWriter.Instance; }
public Logger(IActionLogWriter defaultWriter) { _writer = defaultWriter; _logs = Lazy.Create(CreateLogs); }
protected LocalDockerService(IServiceContainer services) { _ps = services.Process(); _outputLogWriter = services.GetService <IActionLogWriter>(); // TODO: No instance of IActionLogWriter is exported in default IServiceContainer. Need scope support. }