GIT: perform LF normalization
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
[Table("Events")]
|
||||
public class LogEvent
|
||||
{
|
||||
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ModuleId { get; set; }
|
||||
[Required]
|
||||
public int EventTypeId { get; set; }
|
||||
[Required]
|
||||
public DateTime Timestamp { get; set; }
|
||||
public string Arguments { get; set; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
[Table("Events")]
|
||||
public class LogEvent
|
||||
{
|
||||
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ModuleId { get; set; }
|
||||
[Required]
|
||||
public int EventTypeId { get; set; }
|
||||
[Required]
|
||||
public DateTime Timestamp { get; set; }
|
||||
public string Arguments { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
[Table("EventTypes")]
|
||||
public class LogEventType
|
||||
{
|
||||
[Required, Key, Column(Order=0), DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ModuleId { get; set; }
|
||||
[Required, Key, Column(Order = 1), DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int Id { get; set; }
|
||||
[Required, MaxLength(200)]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public int Severity { get; set; }
|
||||
[MaxLength(1024)]
|
||||
public string Format { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool UsePersist { get; set; }
|
||||
[NotMapped]
|
||||
public bool UseLive { get; set; }
|
||||
[NotMapped]
|
||||
public bool UseDisplay { get; set; }
|
||||
|
||||
[ForeignKey("ModuleId")]
|
||||
public LogModule Module { get; set; }
|
||||
|
||||
public enum Severities
|
||||
{
|
||||
Information = 0,
|
||||
Warning = 1,
|
||||
Error = 2
|
||||
}
|
||||
|
||||
public string FormatMessage(object[] Arguments)
|
||||
{
|
||||
|
||||
if (Arguments != null && Arguments.Length > 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Format))
|
||||
{
|
||||
return string.Format(Format, Arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Arguments
|
||||
.Select(v => v == null ? string.Empty : v.ToString())
|
||||
.Aggregate((a, b) => a + ", " + (b == null ? string.Empty : b));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Format))
|
||||
{
|
||||
return Format;
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
[Table("EventTypes")]
|
||||
public class LogEventType
|
||||
{
|
||||
[Required, Key, Column(Order=0), DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ModuleId { get; set; }
|
||||
[Required, Key, Column(Order = 1), DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int Id { get; set; }
|
||||
[Required, MaxLength(200)]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public int Severity { get; set; }
|
||||
[MaxLength(1024)]
|
||||
public string Format { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool UsePersist { get; set; }
|
||||
[NotMapped]
|
||||
public bool UseLive { get; set; }
|
||||
[NotMapped]
|
||||
public bool UseDisplay { get; set; }
|
||||
|
||||
[ForeignKey("ModuleId")]
|
||||
public LogModule Module { get; set; }
|
||||
|
||||
public enum Severities
|
||||
{
|
||||
Information = 0,
|
||||
Warning = 1,
|
||||
Error = 2
|
||||
}
|
||||
|
||||
public string FormatMessage(object[] Arguments)
|
||||
{
|
||||
|
||||
if (Arguments != null && Arguments.Length > 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Format))
|
||||
{
|
||||
return string.Format(Format, Arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Arguments
|
||||
.Select(v => v == null ? string.Empty : v.ToString())
|
||||
.Aggregate((a, b) => a + ", " + (b == null ? string.Empty : b));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Format))
|
||||
{
|
||||
return Format;
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
public class LogLiveEvent
|
||||
{
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleName { get; set; }
|
||||
public string ModuleDescription { get; set; }
|
||||
public int EventTypeId { get; set; }
|
||||
public string EventTypeName { get; set; }
|
||||
public int EventTypeSeverity { get; set; }
|
||||
|
||||
public DateTime Timestamp { get; set; }
|
||||
public object[] Arguments { get; set; }
|
||||
public string FormattedMessage { get; set; }
|
||||
public string FormattedTimestamp { get; set; }
|
||||
public bool UseDisplay { get; set; }
|
||||
|
||||
public static LogLiveEvent Create(LogBase logModule, Models.LogEventType eventType, DateTime Timestamp, string jsonArguments)
|
||||
{
|
||||
object[] Arguments = null;
|
||||
if (jsonArguments != null)
|
||||
{
|
||||
var alArguments = fastJSON.JSON.Instance.Parse(jsonArguments) as ArrayList;
|
||||
if (alArguments != null)
|
||||
{
|
||||
Arguments = alArguments.ToArray();
|
||||
}
|
||||
}
|
||||
return Create(logModule, eventType, Timestamp, Arguments);
|
||||
}
|
||||
|
||||
public static LogLiveEvent Create(LogBase logModule, Models.LogEventType eventType, DateTime Timestamp, params object[] Arguments)
|
||||
{
|
||||
return new Models.LogLiveEvent()
|
||||
{
|
||||
ModuleId = logModule.ModuleId,
|
||||
ModuleName = logModule.ModuleName,
|
||||
ModuleDescription = logModule.ModuleDescription,
|
||||
EventTypeId = eventType.Id,
|
||||
EventTypeName = eventType.Name,
|
||||
EventTypeSeverity = eventType.Severity,
|
||||
Timestamp = Timestamp,
|
||||
Arguments = Arguments,
|
||||
FormattedMessage = eventType.FormatMessage(Arguments),
|
||||
FormattedTimestamp = Timestamp.ToString("dd/MM/yyy hh:mm:ss tt"),
|
||||
UseDisplay = eventType.UseDisplay
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
public class LogLiveEvent
|
||||
{
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleName { get; set; }
|
||||
public string ModuleDescription { get; set; }
|
||||
public int EventTypeId { get; set; }
|
||||
public string EventTypeName { get; set; }
|
||||
public int EventTypeSeverity { get; set; }
|
||||
|
||||
public DateTime Timestamp { get; set; }
|
||||
public object[] Arguments { get; set; }
|
||||
public string FormattedMessage { get; set; }
|
||||
public string FormattedTimestamp { get; set; }
|
||||
public bool UseDisplay { get; set; }
|
||||
|
||||
public static LogLiveEvent Create(LogBase logModule, Models.LogEventType eventType, DateTime Timestamp, string jsonArguments)
|
||||
{
|
||||
object[] Arguments = null;
|
||||
if (jsonArguments != null)
|
||||
{
|
||||
var alArguments = fastJSON.JSON.Instance.Parse(jsonArguments) as ArrayList;
|
||||
if (alArguments != null)
|
||||
{
|
||||
Arguments = alArguments.ToArray();
|
||||
}
|
||||
}
|
||||
return Create(logModule, eventType, Timestamp, Arguments);
|
||||
}
|
||||
|
||||
public static LogLiveEvent Create(LogBase logModule, Models.LogEventType eventType, DateTime Timestamp, params object[] Arguments)
|
||||
{
|
||||
return new Models.LogLiveEvent()
|
||||
{
|
||||
ModuleId = logModule.ModuleId,
|
||||
ModuleName = logModule.ModuleName,
|
||||
ModuleDescription = logModule.ModuleDescription,
|
||||
EventTypeId = eventType.Id,
|
||||
EventTypeName = eventType.Name,
|
||||
EventTypeSeverity = eventType.Severity,
|
||||
Timestamp = Timestamp,
|
||||
Arguments = Arguments,
|
||||
FormattedMessage = eventType.FormatMessage(Arguments),
|
||||
FormattedTimestamp = Timestamp.ToString("dd/MM/yyy hh:mm:ss tt"),
|
||||
UseDisplay = eventType.UseDisplay
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
[Table("Modules")]
|
||||
public class LogModule
|
||||
{
|
||||
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int Id { get; set; }
|
||||
[Required, MaxLength(200)]
|
||||
public string Name { get; set; }
|
||||
[Required, MaxLength(500)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public virtual IList<LogEventType> EventTypes { get; set; }
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Logging.Models
|
||||
{
|
||||
[Table("Modules")]
|
||||
public class LogModule
|
||||
{
|
||||
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int Id { get; set; }
|
||||
[Required, MaxLength(200)]
|
||||
public string Name { get; set; }
|
||||
[Required, MaxLength(500)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public virtual IList<LogEventType> EventTypes { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user