private void ApppendLogsTo(string logFileName, LogEventArg e) { if (logFileName.IsBlank()) { return; } switch (e.Level) { case L4j.Off: // case L4j.Debug: // ignore these levels case L4j.Trace: return; // } if (e.ShowAs != ShowLogAs.Normal) { return; } if (_logFile == null) { _logFile = _fs.File(_fs.GetAssemblyDir().Bslash(logFileName)); } var line = L.f + TextLog.Format(e.Title, e.Message); _logFile.Write(line, EncodeAs.UTF8, false, false); }
private void WriteCachedDate(string d7Changed) { if (_cachedDateFile == null) { _cachedDateFile = GetCachedDateFile(); } _cachedDateFile.Write(d7Changed, raiseLogEvents: false); }
/// <summary> /// Creates a temporary file in the system's temp folder. /// </summary> /// <param name="content"></param> /// <param name="encodeAs"></param> /// <returns></returns> public FileShim TempFile(string content, EncodeAs encodeAs = EncodeAs.UTF8) { string fPath; string errMsg; FileShim tempF = null; Debug_i("Creating temporary file..."); if (!this.TryCreateNewTempFile(out fPath, out errMsg)) { return(Error_o_(tempF, "Failed to create temporary file." + L.F + errMsg)); } Debug_o("created: " + fPath); tempF = this.File(fPath); tempF.Write(content, encodeAs); return(tempF); }
public bool SaveChanges() { if (_file == null) { return(Error_n("Persist() called while _file == NULL.", "Please call ReadFrom() before Persist().")); } var s = _serialr.Write(_creds, true); if (!_file.Write(s, EncodeAs.UTF8)) { return(false); } return(_file.Hidden = true); }