/// <summary> /// Logs an exception as an info message /// </summary> public void Info(Exception ex, string messageFormatString, params object[] formatStringParameters) { string fullMessage = String.Format("A business logic error occured: {0} ({1}). {2}. At: {3}" , ex.Message, ex.Message.GetType().Name , FormattedString(messageFormatString, formatStringParameters) , ex.StackTrace); TheLogger.Info(CallingMethodName + " " + fullMessage); }
public void AquireLease() { //var blobReference = this.container.GetBlobReferenceFromServer("lock"); Logger.Debug("Requesting lease...."); this.lease = this.container.AcquireLease(TimeSpan.FromSeconds(15), this.instanceId); if (string.IsNullOrEmpty(lease)) { this.Exception = new Exception("Could not aquire lease."); Logger.Info("Got exception on lease: ", this.Exception); } else { this.Exception = null; Logger.DebugFormat("Got lease.... {0}", this.lease); } }
public void Log(LogLevel level, Exception ex, string messageFormatString, params object[] formatStringParameters) { switch (level) { case LogLevel.Debug: { TheLogger.Debug(CallingMethodName + " " + FormattedString(messageFormatString, formatStringParameters) + ex.ToFullException() , ex); break; } case LogLevel.Info: { TheLogger.Info(CallingMethodName + " " + FormattedString(messageFormatString, formatStringParameters) + ex.ToFullException(), ex); break; } case LogLevel.Warn: { TheLogger.Warn(CallingMethodName + " " + FormattedString(messageFormatString, formatStringParameters) + ex.ToFullException(), ex); break; } case LogLevel.Error: Error(ex, messageFormatString, formatStringParameters); break; case LogLevel.Fatal: Fatal(ex, messageFormatString, formatStringParameters); break; default: throw new InvalidOperationException("Unknown LogLevel"); } }
public void Info(string messageFormatString, params object[] formatStringParameters) { TheLogger.Info(FormattedString(messageFormatString, formatStringParameters)); }