示例#1
0
        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);
        }
示例#2
0
        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();
            }
        }
示例#3
0
 internal Logger(IActionLogWriter defaultWriter, ILoggingPermissions permissions)
 {
     _writer      = defaultWriter;
     _permissions = permissions;
     _logs        = Lazy.Create(CreateLogs);
 }
示例#4
0
文件: Logger.cs 项目: Microsoft/RTVS
 internal Logger(string appName, ILoggingPermissions permissions, IActionLogWriter writer) {
     _appName = appName;
     _permissions = permissions;
     _writer = writer;
 }
示例#5
0
 private ProjectSystemActionLog(IActionLogWriter logWriter) :
     base(logWriter)
 {
 }
示例#6
0
 public LinesLog(IActionLogWriter logWriter) : base(logWriter) { }
示例#7
0
 public StringLog(IActionLogWriter logWriter)
 {
     _logWriter = logWriter ?? NullLogWriter.Instance;
 }
示例#8
0
 internal Logger(string appName, ILoggingPermissions permissions, IActionLogWriter writer)
 {
     _appName     = appName;
     _permissions = permissions;
     _writer      = writer;
 }
 private ProjectSystemActionLog(IActionLogWriter logWriter) :
     base(logWriter) {
 }
示例#10
0
 public LinesLog(IActionLogWriter logWriter) : base(logWriter)
 {
 }
示例#11
0
 public Logger(IActionLogWriter defaultWriter)
 {
     _writer = defaultWriter;
     _logs   = Lazy.Create(CreateLogs);
 }
示例#12
0
 public StringLog(IActionLogWriter logWriter) {
     _logWriter = logWriter ?? NullLogWriter.Instance;
 }
示例#13
0
 protected LocalDockerService(IServiceContainer services)
 {
     _ps = services.Process();
     _outputLogWriter = services.GetService <IActionLogWriter>();
     // TODO: No instance of IActionLogWriter is exported in default IServiceContainer. Need scope support.
 }