Walter.BOM
ExceptionLogging Class
Members  Example 
Walter.BOM Assembly > Walter.BOM Namespace : ExceptionLogging Class
Represents a record for logging exceptions, encapsulating details about the exception context.
Syntax
public class ExceptionLogging 
Remarks
This record is designed to be used within the Walter.BOM package to log exception information, including the application name, message, calling method, file name, and line number where the exception occurred. It is essential for tracking and diagnosing errors in applications.
Example
A minimal API approach in ASP.NET Core provides a more concise way to define simple APIs with less boilerplate code. Below is an example of how you can use a minimal API to create an endpoint for logging exceptions using the ExceptionLogging class
using Microsoft.AspNetCore.Builder;
            using Microsoft.AspNetCore.Http.Json;
            using Microsoft.Extensions.DependencyInjection;
                ///
            var builder = WebApplication.CreateBuilder(args);
                ///
            // Configure JSON options if necessary (e.g., to set up property naming policies)
            builder.Services.Configure<JsonOptions>(options =>
            {
            // Configure JSON serialization settings if needed
            });
                ///
            var app = builder.Build();
                ///
            // Define a POST endpoint for logging exceptions
            app.MapPost("/log-exception", (ExceptionLogging exceptionLogging) =>
            {
            if (exceptionLogging == null)
            {
            return Results.BadRequest("Exception details are required.");
            }
                ///
            // Log the exception details. Here, we're just writing to the console for demonstration.
            Console.WriteLine($"ApplicationName: {exceptionLogging.ApplicationName}");
            Console.WriteLine($"Message: {exceptionLogging.Message}");
            Console.WriteLine($"CallingMethod: {exceptionLogging.CallingMethod}");
            Console.WriteLine($"FileName: {exceptionLogging.FileName}");
            Console.WriteLine($"LineNumber: {exceptionLogging.LineNumber}");
                ///
            // Respond that the exception details have been received and logged.
            return Results.Ok("Exception details logged successfully.");
            });
                ///
            app.Run();
Inheritance Hierarchy

System.Object
   Walter.BOM.ExceptionLogging

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ExceptionLogging Members
Walter.BOM Namespace