public void WriteToLogFile(string category, Logging.LevelEnum level, int relStack, string text) { YetaWFManager.Syncify(async() => { // Logging is sync by definition (this is only used for startup logging) using (ILockObject lockObject = await YetaWF.Core.IO.Caching.LockProvider.LockResourceAsync(LogFile)) { await FileSystem.FileSystemProvider.AppendAllTextAsync(LogFile, text + "\r\n"); await lockObject.UnlockAsync(); } }); }
public void WriteToLogFile(string category, Logging.LevelEnum level, int relStack, string text) { if (!YetaWFManager.HaveManager) { return; } if (YetaWFManager.Manager != LimitToManager) { return; // this log entry is for another thread } YetaWFManager.Syncify(async() => { // Logging is sync (because most log providers like NLog use async tasks), not worth the trouble to make this async. Scheduler is separate thread anyway. await logDP.AddItemAsync(new DataProvider.LogData { TimeStamp = DateTime.UtcNow, RunId = CurrentId, Name = CurrentName, Level = level, SiteIdentity = CurrentSiteId, Info = text, }); }); }