/// <summary> /// Add caller data. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <param name="settingsBuilder"><see cref="SettingsBuilder{TClass}"/>.</param> /// <param name="callerSource">Caller source.</param> /// <param name="callerSourceLineNumber">Caller source line number.</param> /// <returns> /// Returns <see cref="SettingsBuilder{TClass}"/>. /// </returns> public static SettingsBuilder <TClass> CallerSourceData <TClass>(this SettingsBuilder <TClass> settingsBuilder, [CallerFilePath] string callerSource = "", [CallerLineNumber] int callerSourceLineNumber = 0) where TClass : class { return(settingsBuilder.AddCallerSourceData(callerSource, callerSourceLineNumber)); }
/// <summary> /// Add custom data. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <param name="settingsBuilder"><see cref="SettingsBuilder{TClass}"/>.</param> /// <param name="key">Key.</param> /// <param name="value">Value.</param> /// <returns> /// Returns <see cref="SettingsBuilder{TClass}"/>. /// </returns> public static SettingsBuilder <TClass> CustomData <TClass>(this SettingsBuilder <TClass> settingsBuilder, string key, object value) where TClass : class { return(settingsBuilder.AddCustomData(key, value)); }
/// <summary> /// Set Action to handle exceptions that occur. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <param name="settingsBuilder"><see cref="SettingsBuilder{TClass}"/>.</param> /// <param name="exceptionHandler">Action to handle exceptions that occur.</param> /// <returns> /// Returns <see cref="SettingsBuilder{TClass}"/>. /// </returns> public static SettingsBuilder <TClass> ExceptionHandler <TClass>(this SettingsBuilder <TClass> settingsBuilder, Action <Exception> exceptionHandler = null) where TClass : class { return(settingsBuilder.WithExceptionHandler(exceptionHandler)); }
/// <summary> /// Set caller name. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <param name="settingsBuilder"><see cref="SettingsBuilder{TClass}"/>.</param> /// <param name="caller">Caller name.</param> /// <returns> /// Returns <see cref="SettingsBuilder{TClass}"/>. /// </returns> public static SettingsBuilder <TClass> CallerFrom <TClass>(this SettingsBuilder <TClass> settingsBuilder, string caller) where TClass : class { return(settingsBuilder.WithCaller(caller)); }
/// <summary> /// Set <see cref="IHttpContextAccessor"/> to get the ip address of the caller. /// </summary> /// <typeparam name="TClass">Class with methods.</typeparam> /// <param name="settingsBuilder"><see cref="SettingsBuilder{TClass}"/>.</param> /// <param name="httpContextAccessor"><see cref="IHttpContextAccessor"/>.</param> /// <returns> /// Returns <see cref="SettingsBuilder{TClass}"/>. /// </returns> public static SettingsBuilder <TClass> CallerFrom <TClass>(this SettingsBuilder <TClass> settingsBuilder, IHttpContextAccessor httpContextAccessor) where TClass : class { return(settingsBuilder.WithHttpContextAccessor(httpContextAccessor)); }