Add project files.
This commit is contained in:
		| @@ -0,0 +1,44 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="ErrorDetailsDto.cs"> | ||||
| //     Heath | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
|  | ||||
| using Lib.Common.LoggingAPI.Service.Constants; | ||||
| using System.ComponentModel; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Lib.Common.LoggingAPI.Service.DataTransferObjects.Error | ||||
| { | ||||
|     /// <summary> | ||||
|     /// The service error details transfer object. | ||||
|     /// </summary> | ||||
|     public class ErrorDetailsDto | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Gets or sets the service error code. | ||||
|         /// </summary> | ||||
|         /// <example>healthy</example> | ||||
|         [DisplayName(DisplayNames.ErrorCode)] | ||||
|         [JsonPropertyName(DisplayNames.ErrorCode)] | ||||
|         public string? ErrorCode { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the service error message. | ||||
|         /// </summary> | ||||
|         /// <example>This is an example message.</example> | ||||
|         [DisplayName(DisplayNames.Message)] | ||||
|         [JsonPropertyName(DisplayNames.Message)] | ||||
|         public string? Message { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the service target. | ||||
|         /// </summary> | ||||
|         /// <example>healthy</example> | ||||
|         [DisplayName(DisplayNames.Target)] | ||||
|         [JsonPropertyName(DisplayNames.Target)] | ||||
|         public string? Target { get; set; } | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -0,0 +1,46 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="HttpErrorDto.cs"> | ||||
| //     Heath | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
|  | ||||
| using Lib.Common.LoggingAPI.Service.Constants; | ||||
| using System.ComponentModel; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Lib.Common.LoggingAPI.Service.DataTransferObjects.Error | ||||
| { | ||||
|     /// <summary> | ||||
|     /// The service HTTP error data transfer object. | ||||
|     /// </summary> | ||||
|     public class HttpErrorDto | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Gets or sets the error. | ||||
|         /// </summary> | ||||
|         [DisplayName(DisplayNames.Error)] | ||||
|         [JsonPropertyName(DisplayNames.Error)] | ||||
|         public ErrorDetailsDto Error { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Creates a new instance of <see cref="HttpErrorDto{TMessage}"/> | ||||
|         /// with custom parameters. | ||||
|         /// </summary> | ||||
|         /// <param name="message">The HTTP error message.</param> | ||||
|         /// <param name="errorCode">The HTTP error code.</param> | ||||
|         /// <param name="target">The HTTP error target.</param> | ||||
|         public HttpErrorDto( | ||||
|             string? message, | ||||
|             string? errorCode, | ||||
|             string? target) | ||||
|         { | ||||
|             this.Error = new ErrorDetailsDto | ||||
|             { | ||||
|                 ErrorCode = errorCode, | ||||
|                 Message = message, | ||||
|                 Target = target, | ||||
|             }; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,121 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="LogDetail.cs"> | ||||
| //     Heath | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
|  | ||||
| using Lib.Common.LoggingAPI.Service.Constants; | ||||
| using System.ComponentModel; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Lib.Common.LoggingAPI.Service.DataTransferObjects.Logger | ||||
| { | ||||
|     /// <summary> | ||||
|     /// The service logger detail object. | ||||
|     /// </summary> | ||||
|     /// <typeparam name="TMessage">The generic message type.</typeparam> | ||||
|     public class LogDetail<TMessage> | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Gets or sets the log severity. | ||||
|         /// </summary> | ||||
|         /// <example>info</example> | ||||
|         [DisplayName(DisplayNames.Severity)] | ||||
|         [JsonPropertyName(DisplayNames.Severity)] | ||||
|         public LogSeverity Severity { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the timestamp. | ||||
|         /// </summary> | ||||
|         [DisplayName(DisplayNames.Timestamp)] | ||||
|         [JsonPropertyName(DisplayNames.Timestamp)] | ||||
|         public DateTime Timestamp { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the environment. | ||||
|         /// </summary> | ||||
|         /// <example>Development</example> | ||||
|         [DisplayName(DisplayNames.Environment)] | ||||
|         [JsonPropertyName(DisplayNames.Environment)] | ||||
|         public string? Environment { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the target. | ||||
|         /// </summary> | ||||
|         [DisplayName(DisplayNames.Target)] | ||||
|         [JsonPropertyName(DisplayNames.Target)] | ||||
|         public LogTarget? Target { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the x-forwarded-for header. | ||||
|         /// </summary> | ||||
|         /// <example>localhost</example> | ||||
|         [DisplayName(DisplayNames.XForwardedFor)] | ||||
|         [JsonPropertyName(DisplayNames.XForwardedFor)] | ||||
|         public string? XForwardedFor { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the service identifier.  | ||||
|         /// </summary> | ||||
|         /// <example><see cref="Guid.NewGuid()"/></example> | ||||
|         [DisplayName(DisplayNames.ServiceId)] | ||||
|         [JsonPropertyName(DisplayNames.ServiceId)] | ||||
|         public string? ServiceId { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the request identifier. | ||||
|         /// </summary> | ||||
|         /// <example><see cref="Guid.NewGuid()"/></example> | ||||
|         [DisplayName(DisplayNames.RequestId)] | ||||
|         [JsonPropertyName(DisplayNames.RequestId)] | ||||
|         public string? RequestId { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the client identifier. | ||||
|         /// </summary> | ||||
|         /// <example><see cref="Guid.NewGuid()"/></example> | ||||
|         [DisplayName(DisplayNames.ClientId)] | ||||
|         [JsonPropertyName(DisplayNames.ClientId)] | ||||
|         public string? ClientId { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the client identifier. | ||||
|         /// </summary> | ||||
|         /// <example>clientRequest</example> | ||||
|         [DisplayName(DisplayNames.Operation)] | ||||
|         [JsonPropertyName(DisplayNames.Operation)] | ||||
|         public LogOperation Operation { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the user name. | ||||
|         /// </summary> | ||||
|         /// <example>clientRequest</example> | ||||
|         [DisplayName(DisplayNames.User)] | ||||
|         [JsonPropertyName(DisplayNames.User)] | ||||
|         public string? User { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets user's email. | ||||
|         /// </summary> | ||||
|         /// <example>clientRequest</example> | ||||
|         [DisplayName(DisplayNames.Email)] | ||||
|         [JsonPropertyName(DisplayNames.Email)] | ||||
|         public string? Email { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the user identifier. | ||||
|         /// </summary> | ||||
|         /// <example>clientRequest</example> | ||||
|         [DisplayName(DisplayNames.UserId)] | ||||
|         [JsonPropertyName(DisplayNames.UserId)] | ||||
|         public string? UserId { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the message. | ||||
|         /// </summary> | ||||
|         /// <example>A custom log message.</example> | ||||
|         [DisplayName(DisplayNames.Message)] | ||||
|         [JsonPropertyName(DisplayNames.Message)] | ||||
|         public TMessage? Message { get; set; } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,56 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="LogOperation.cs"> | ||||
| //     Heath | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
|  | ||||
| using Lib.Common.LoggingAPI.Service.Constants; | ||||
| using System.Runtime.Serialization; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Lib.Common.LoggingAPI.Service.DataTransferObjects.Logger | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Represents all possible values for log operation. | ||||
|     /// </summary> | ||||
|     [DataContract] | ||||
|     public enum LogOperation | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// The client request log operation type. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.ClientRequest)] | ||||
|         [JsonPropertyName(DisplayNames.ClientRequest)] | ||||
|         ClientRequest = 0, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The client response log operation type. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.ClientResponse)] | ||||
|         ClientResponse = 1, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The external request log operation type. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.ExternalRequest)] | ||||
|         ExternalRequest = 2, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The external response log operation type. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.ExternalResponse)] | ||||
|         ExternalResponse = 3, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The error log operation type. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.Error)] | ||||
|         Error = 4, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The info log operation type. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.Info)] | ||||
|         Info = 5, | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,42 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="LogSeverity.cs"> | ||||
| //     Heath | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
|  | ||||
| using Lib.Common.LoggingAPI.Service.Constants; | ||||
| using System.Runtime.Serialization; | ||||
|  | ||||
| namespace Lib.Common.LoggingAPI.Service.DataTransferObjects.Logger | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Represents all possible values for log severity. | ||||
|     /// </summary> | ||||
|     [DataContract] | ||||
|     public enum LogSeverity | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// The information severity level. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.Information)] | ||||
|         Info = 0, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The warning severity level. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.Warning)] | ||||
|         Warn = 1, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The error severity level. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.Error)] | ||||
|         Error = 2, | ||||
|  | ||||
|         /// <summary> | ||||
|         /// The fatal severity level. | ||||
|         /// </summary> | ||||
|         [EnumMember(Value = DisplayNames.Fatal)] | ||||
|         Fatal = 3, | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,42 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="LogTarget.cs"> | ||||
| //     Heath | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
|  | ||||
| using Lib.Common.LoggingAPI.Service.Constants; | ||||
| using System.ComponentModel; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace Lib.Common.LoggingAPI.Service.DataTransferObjects.Logger | ||||
| { | ||||
|     /// <summary> | ||||
|     /// The service logger target object. | ||||
|     /// </summary> | ||||
|     public class LogTarget | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Gets or sets the log target method. | ||||
|         /// </summary> | ||||
|         /// <example>GET</example> | ||||
|         [DisplayName(DisplayNames.Method)] | ||||
|         [JsonPropertyName(DisplayNames.Method)] | ||||
|         public string? Method { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the log target host. | ||||
|         /// </summary> | ||||
|         /// <example>GET</example> | ||||
|         [DisplayName(DisplayNames.Host)] | ||||
|         [JsonPropertyName(DisplayNames.Host)] | ||||
|         public string? Host { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Gets or sets the log target route. | ||||
|         /// </summary> | ||||
|         /// <example>GET</example> | ||||
|         [DisplayName(DisplayNames.Route)] | ||||
|         [JsonPropertyName(DisplayNames.Route)] | ||||
|         public string? Route { get; set; } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin