private void Write(string msg, LogLevel messageLogLevel) { if (messageLogLevel.SkipMessage(_loggerLogLevel)) { return; } try { Locker.AcquireWriterLock(int.MaxValue); _outputPath.Create(); using (var sw = File.AppendText(Path.Combine(_outputPath, _fileName))) { var logLine = $"{DateTime.Now:yyyy.MM.dd-HH:mm:ss.ffffff} {messageLogLevel.GetPrefix()}: {msg}"; sw.WriteLine(logLine); sw.Close(); } } finally { Locker.ReleaseWriterLock(); } }