private static void RecordLogEvent(LogEventArgs args) { if (args != null) { var sb = new StringBuilder(); sb.AppendLine(args.Message); if (args.Exception != null) { sb.AppendLine(args.Exception.Message); } if (args.Api != null) { // if (args.Api.VaultConfiguration != null) // { // sb.AppendLine(string.Format("Customer Alias: {0}", args.VaultApi.VaultConfiguration.CustomerAlias)); // sb.AppendLine(string.Format("Database Alias: {0}", args.VaultApi.VaultConfiguration.DatabaseAlias)); // if (args.VaultApi.CurrentUser != null) // sb.AppendLine(string.Format("User ID: {0}", args.VaultApi.CurrentUser.GetCurrentUserID())); // } } string recordedMessage = RecordMessage(sb.ToString(), args.LogLevel); } }
public static void OnLogEventHandler(object sender, LogEventArgs args) { RecordLogEvent(args); }
/// <summary> /// The raise exception. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> internal static void RaiseException(object sender, LogEventArgs e) { if (Mute) { return; } if (e != null) { switch (e.LogLevel) { case LogLevelType.Verbose: if (OnVerbose != null) { OnVerbose(sender, e); } break; case LogLevelType.Debug: if (OnDebug != null) { OnDebug(sender, e); } break; case LogLevelType.Info: if (OnInfo != null) { OnInfo(sender, e); } break; case LogLevelType.Warn: if (OnWarn != null) { OnWarn(sender, e); } break; case LogLevelType.Error: if (OnError != null) { OnError(sender, e); } break; case LogLevelType.Fatal: if (OnFatal != null) { OnFatal(sender, e); } break; default: if (OnDebug != null) { OnDebug(sender, e); } break; } } }