Ejemplo n.º 1
0
        private string GetFilePath()
        {
            var settings = _loggerSettingsRepository.Get();
            var path     = Path.Combine(settings.OutputPath, settings.OutputFileName);
            var file     = new FileInfo(path);

            file.Directory.Create();
            return(file.FullName);
        }
Ejemplo n.º 2
0
        public FileLogger(
            ILogEntryFormatter logEntryFormatter,
            ILoggerSettingsRepository loggerSettingsRepository
            ) : base(logEntryFormatter)
        {
            Settings = loggerSettingsRepository.Get();

            lock (lockObj)
            {
                using (var streamWriter = new StreamWriter(GetFilePath(), false))
                {
                    streamWriter.WriteLine(string.Empty);
                    streamWriter.Close();
                }
            }
        }