/// <summary> /// Initializes a new instance of the <see cref="LogFile" /> class. /// </summary> /// <param name="fileStream">The file stream.</param> /// <param name="fileName">Name of the file.</param> /// <param name="format">The format.</param> /// <param name="start">The start.</param> public LogFile( [NotNull] FileStream fileStream, [NotNull] string fileName, [NotNull] FormatBuilder format, DateTime start) { Format = format; Start = start; // Calculate style. Style = Format == Log.XMLFormat ? LogFileStyle.XML : (Format == Log.JSONFormat ? LogFileStyle.JSON : LogFileStyle.Text); FileName = fileName; _fileStream = fileStream; switch (Style) { case LogFileStyle.XML: WriteLine("<Logs>" + Environment.NewLine + "</Logs>").Wait(); break; case LogFileStyle.JSON: WriteLine("[" + Environment.NewLine + "]").Wait(); break; default: Write(Format.ToString("F") + Environment.NewLine + Environment.NewLine) .Wait(); break; } }