private async Task LogBatchRequest(BatchData batch, string message, BatchManager.BatchResult result, bool autoWrite) { await LogBatchRequest(batch, message, result); if (autoWrite) { Write(); } }
private async Task LogBatchRequest(BatchData batch, string message, BatchManager.BatchResult result) { if (type == LogType.Request) { if (message == null) { logger.AddLine(string.Format("Batch {0} Requested. Result: {1}", batch.Key, result)); } else { logger.AddLine(string.Format(message + "Result: {1}", batch.Key, result)); } } else { var exLogger = new Logging(LogType.Exceptions); Exception ex = new Exception(exceptionMessage(LogType.Request)); exLogger.LogException(typeof(Logging), ex, false, true); throw ex; } }
private async Task LogBatchResult(Type instance, BatchData batch, string message, BatchManager.BatchResult result, bool autoWrite) { await LogBatchResult(instance, batch, message, result); if (autoWrite) { Write(); } }
private async Task LogBatchResult(Type instance, BatchData batch, string message, BatchManager.BatchResult result) { if (type == LogType.Results) { if (batch == null) { batch = new BatchData(); batch.Id = -1; batch.Key = "Null Batch"; batch.isAvail = false; batch.isListed = true; batch.LastComplete = 500; } if (message == null) { logger.AddLine(string.Format("Class {0}:", instance.ReflectedType.ToString())); logger.AddLine(string.Format("Batch {0} Result: {1}", batch.Key, result)); } else { logger.AddLine(string.Format("Class {0}:", instance.ReflectedType.ToString())); logger.AddLine(string.Format(message + "Result: {1}", batch.Key, result)); } } else { var exLogger = new Logging(LogType.Exceptions); Exception ex = new Exception(exceptionMessage(LogType.Request)); exLogger.LogException(typeof(Logging), ex, false, true); throw ex; } }
/// <summary> /// Full Logger. Separates based on log type. Only use if neccessary /// </summary> /// <param name="ins"></param> /// <param name="batch"></param> /// <param name="message"></param> /// <param name="ex"></param> /// <param name="result"></param> /// <param name="isTrue"></param> /// <param name="autoWrite"></param> /// <returns></returns> public async Task Log(Type ins, BatchData batch, string message, Exception ex, BatchManager.BatchResult result, bool isTrue, bool autoWrite) { // Main Logger switch (type) { case LogType.Update: LogBatchUpdate(batch, message, autoWrite); break; case LogType.Add: LogBatchAdd(batch, message, autoWrite); break; case LogType.Exceptions: LogException(ins, ex, isTrue, autoWrite); break; case LogType.Request: LogBatchRequest(batch, message, result, autoWrite); break; case LogType.Results: LogBatchResult(ins, batch, message, result, autoWrite); break; default: logger.Write(message); break; } }
/// <summary> /// Request Log w/ Autowrite /// </summary> /// <param name="batch"></param> /// <param name="message"></param> /// <param name="result"></param> /// <param name="autoWrite"></param> /// <returns></returns> public async Task Log(BatchData batch, string message, BatchManager.BatchResult result, bool autoWrite) { // Request Log w/ Autowrite Log(null, batch, message, null, result, false, autoWrite); }
/// <summary> /// Request Log w/o autoWrite /// </summary> /// <param name="batch"></param> /// <param name="message"></param> /// <param name="result"></param> /// <returns></returns> public async Task Log(BatchData batch, string message, BatchManager.BatchResult result) { // Request Log Log(null, batch, message, null, result, false, false); }
/// <summary> /// Result Log w/o autoWrite /// </summary> /// <param name="ins"></param> /// <param name="batch"></param> /// <param name="message"></param> /// <param name="result"></param> /// <returns></returns> public async Task Log(Type ins, BatchData batch, string message, BatchManager.BatchResult result) { // Result Log Log(ins, batch, message, null, result, false, false); }