private void InnerRun(string path, bool flushAfterEveryWrite) { if (Misc.AllocateFile(path, out var counter)) { Logger.LogAs(null, LogLevel.Warning, "Previous log file detected and renamed to: {0}.{1}", path, counter); } Logger.AddBackend(new FileBackend(path, flushAfterEveryWrite), "file", true); }
public UartFileBackend(string path, IUART uart, bool immediateFlush = false) { if (Misc.AllocateFile(path, out var id)) { Logger.LogAs(uart, LogLevel.Warning, "Previous UART output file renamed to: {0}.{1}", path, id); } this.uart = uart; this.immediateFlush = immediateFlush; writer = new BinaryWriter(File.Open(path, FileMode.Open)); uart.CharReceived += WriteChar; }