internal ErrorLog(string issuedBy, string issuedMsg, SeverityEnum severity) { IssuedBy = issuedBy; IssuedDate = DateTime.Now; IssuedMessage = issuedMsg; SeverityEnum = severity; }
public static string GetCode(SeverityEnum value) { switch (value) { case SeverityEnum.Ok: return(Ok); case SeverityEnum.Debug: return(Debug); case SeverityEnum.Info: return(Info); case SeverityEnum.Warning: return(Warning); case SeverityEnum.Error: return(Error); case SeverityEnum.Fatal: return(Fatal); default: throw new ArgumentOutOfRangeException(nameof(value), value, null); } }
/// <summary> /// Instantiates a new LoggerService. /// This will check that the table exits and that all columns are compliant. /// The constructor also store the max length of the columns so that the /// info will be properly truncated when logging the data into the db. /// The constructor throws a system exception when the table definition /// does not comply to the requested pre-conditions. /// </summary> /// <param name="msSqlConnectionString"></param> /// <param name="logLevel"></param> /// <param name="tableSchema"></param> /// <param name="tableName"></param> /// <param name="userIdColumnName">name of the UserId column (should be varchar nullable)</param> /// <param name="companyIdColumnName">name of the CompanyId column (should be varchar nullable)"</param> /// <param name="machineNameColumnName">name of the MachineName column (should be varchar non nullable)</param> /// <param name="severityCodeColumnName">name of the SeverityCode column (should be char non nullable)</param> /// <param name="contextColumnName">name of the Context column (should be varchar non nullable)"</param> /// <param name="topicColumnName">name of the Topic column (should be varchar nullable)</param> /// <param name="messageColumnName">name of the Message column (should be varchar(MAX) non nullable)</param> /// <param name="createDateColumnName">name of the CreateDateUtc column (should be datetime non nullable)</param> public MsSqlLogger( string msSqlConnectionString, SeverityEnum logLevel, string tableSchema, string tableName, string userIdColumnName, string companyIdColumnName, string machineNameColumnName, string severityCodeColumnName, string contextColumnName, string topicColumnName, string messageColumnName, string createDateColumnName) { _msSqlConnectionString = msSqlConnectionString; _logLevel = logLevel; _tableSchema = tableSchema; _tableName = tableName; _userIdColumnName = userIdColumnName; _companyIdColumnName = companyIdColumnName; _machineNameColumnName = machineNameColumnName; _severityCodeColumnName = severityCodeColumnName; _contextColumnName = contextColumnName; _topicColumnName = topicColumnName; _messageColumnName = messageColumnName; _createDateColumnName = createDateColumnName; CheckTable(); }
public Message(SeverityEnum severity, string description, int line, int column) { Severity = severity; Description = description; Line = line; Column = column; }
public DefectAttribute(PriorityEnum priority, SeverityEnum severity, string description = "", params string [] steps) { this.Priority = priority; this.Severity = severity; this.Description = description; this.Steps = steps; }
public Impact(SeverityEnum severity, CompletionEnum completion, AssessmentTypeEnum aType, string description) { this.severity = severity; this.completion = completion; assessmentType = aType; this.description = description; }
public DsoHttpResultNotification( SeverityEnum severity, string message) { SeverityCode = EnumSeverity.GetCode(severity); Message = message; }
private static void SaveLog(string issuedBy, SeverityEnum severity, SystemError sys, string issuedMessage) { if (issuedMessage.Length >= 4000) { issuedMessage = issuedMessage.Substring(0, 4000); } var options = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }; using (var exceptionLogScope = new TransactionScope(TransactionScopeOption.RequiresNew, options)) { using (var container = new TransactionModelContainer()) { container.ErrorLogs.AddObject(new ErrorLog { IssuedBy = issuedBy, IssuedDate = DateTime.Now, IssuedMessage = issuedMessage, Severity = (byte)severity, SystemErrorId = (byte)sys, SystemErrorName = sys.ToString(), }); container.SaveChanges(); exceptionLogScope.Complete(); } } }
/// <summary> /// Enables to set the StatusCode /// </summary> /// <param name="severity"></param> public DsoHttpResult(SeverityEnum severity) { StatusCode = EnumSeverity.GetCode(severity); Notifications = new List <DsoHttpResultNotification>(); MutationCode = EnumMutation .GetCode(MutationEnum.None); }
private void Log(SeverityEnum severity, string message, Exception exception = null) { Console.WriteLine($"{severity.ToString()}:{message}"); if (exception != null) { Console.WriteLine($"Stack Trace : {exception.StackTrace}"); } }
public void Log( Exception e, SeverityEnum severity = SeverityEnum.Fatal, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = -1) { Log(e.GetDeepMessage(), severity, callerMemberName, callerFilePath, callerLineNumber); }
public Pri(string strPri) { int intPri = Convert.ToInt32(strPri); int intFacility = intPri >> 3; int intSeverity = intPri & 0x7; this.Facility = (FacilityEnum)Enum.Parse(typeof(FacilityEnum), intFacility.ToString()); this.Severity = (SeverityEnum)Enum.Parse(typeof(SeverityEnum), intSeverity.ToString()); }
public CustomerEventFoundError(DateTime dateTime, int customerId, SupplierEventTypeEnum type, ModuleEnum module, SeverityEnum severity) : base(dateTime) { EventType = type; Module = module; Severity = severity; CustomerID = customerId; }
public MethodResult(IEnumerable <string> messages, SeverityEnum severity) : this() { foreach (var message in messages) { AddNotification(message, severity); } }
public void Log( string message, SeverityEnum severity = SeverityEnum.Debug, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { Log(message, _topic, severity, memberName, filePath, lineNumber); }
public void Log( IEnumerable <string> messages, SeverityEnum severity, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { Log(messages, _topic, severity, memberName, filePath, lineNumber); }
public ErrorModel(Exception e, string appName, string methodName, SeverityEnum severity, string message = "") { this.Time = DateTime.Now; this.Severity = severity; this.AppName = appName; this.MethodName = methodName; this.ExceptionDetails = GetExceptionDetails(e); this.Message = message; }
/// <summary> /// Logs an occurring error to the system. The log will actually create after a SaveChanges call. /// </summary> /// <param name="issuedBy">Issuer</param> /// <param name="issuedMsg">Message to log</param> /// <param name="severity">Severity (default = LOW)</param> /// <remarks>container.SaveChanges is required</remarks> public static ErrorLog LogsError(TransactionModelContainer container, string issuedBy, string issuedMsg, SeverityEnum severity = SeverityEnum.LOW) { var log = new ErrorLog(issuedBy, issuedMsg, severity); container.ErrorLogs.AddObject(log); return(log); }
public void Log( Exception e, SeverityEnum severity = SeverityEnum.Fatal, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { Log(e, _topic, severity, memberName, filePath, lineNumber); }
public async Task LogAsync( Exception e, SeverityEnum severity = SeverityEnum.Fatal, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { await WriteLogAsync(e.GetDeepMessage(), _topic, severity, memberName, filePath, lineNumber); }
public async Task LogAsync( string message, SeverityEnum severity = SeverityEnum.Debug, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { await WriteLogAsync(message, _topic, severity, memberName, filePath, lineNumber); }
protected DsoHttpResult( SeverityEnum severity, bool hasMoreResults, MutationEnum mutation = MutationEnum.None) : this() { StatusCode = EnumSeverity.GetCode(severity); MutationCode = EnumMutation.GetCode(mutation); HasMoreResults = hasMoreResults; }
public async Task LogAsync( IEnumerable <string> messages, SeverityEnum severity, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { await WriteLogAsync(GetMessage(messages), _topic, severity, memberName, filePath, lineNumber); }
public void Log( string message = "pass", SeverityEnum severity = SeverityEnum.Debug, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = -1) { var line = $"{severity}-{callerMemberName}-{callerFilePath}-{callerLineNumber}-{message}"; Console.WriteLine(line); }
public MsSqlLogger( string msSqlConnectionString, SeverityEnum logLevel = SeverityEnum.Debug, Guid?userId = null, Guid?companyId = null) { _msSqlConnectionString = msSqlConnectionString; UserId = userId; CompanyId = companyId; _logLevel = logLevel; }
public void Log( Exception e, string topic, SeverityEnum severity = SeverityEnum.Fatal, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { WriteLog(e.GetDeepMessage(), topic, severity, memberName, filePath, lineNumber); }
public void WriteTrace(string text, Exception ex, SeverityEnum severety, Category area) { Local.WriteTrace(0, Local[area], Get(severety), text + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace); //var line=string.Format("{0,24}: {1,20} {2} {3}"+Environment.NewLine, CurTime, severety, area, text); //Debug.Write(text); //var desktop=Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //var log=Path.Combine(desktop, "log.txt"); //if(!File.Exists(log))File.WriteAllText(log,""); //File.AppendAllText(log, line); }
public static string GetCode(SeverityEnum value) { return(value switch { SeverityEnum.Ok => Ok, SeverityEnum.Debug => Debug, SeverityEnum.Info => Info, SeverityEnum.Warning => Warning, SeverityEnum.Error => Error, SeverityEnum.Fatal => Fatal, _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) });
public override void Write(SeverityEnum severity, string message) { using (DatabaseLoggerContext context = new DatabaseLoggerContext()) { context.Logs.Add(new DatabaseLogs { Severity = severity.ToString(), Message = message, Time = DateTime.Now }); context.SaveChanges(); } }
public void Log( Exception e, string topic, SeverityEnum severity = SeverityEnum.Fatal, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = -1) { var exception = GetDeepMessage(e); var stackTrace = e.StackTrace; var message = $"Exception: {exception}{Environment.NewLine}StackTrace: {stackTrace}"; Log(message, topic, severity, memberName, filePath, lineNumber); }
public async Task <Ticket> CreateTicket(string summary, string company, SeverityEnum severity) { Ticket ticket = new Ticket() { Summary = summary, Severity = severity, Company = new CompanyReference() { Identifier = company } }; return(await CreateTicket(ticket)); }
public MessageStruct(FacilityEnum f, SeverityEnum s, string MsgId, string Message) { this.Pri = new PriStruct(f, s); this.TimeStamp = DateTime.Now; this.Source = null; this.Message = Message; this.Hostname = Environment.MachineName; this.AppName = curProcName; this.ProcID = curProcId; this.MsgID = MsgId; this.StructuredDataId = "-"; this.StructuredData = new Dictionary <string, string>(); }
private static string GetSeverityString(SeverityEnum severity) { switch (severity) { case SeverityEnum.Critical: return "critical"; case SeverityEnum.Debug: return "debug"; case SeverityEnum.Error: return "error"; case SeverityEnum.Info: return "info"; case SeverityEnum.Warning: return "warning"; default: Debug.Fail("Invalid branch."); return "critical"; } }
public static void ReportError(SeverityEnum severityEnum, string messageText, bool async = true) { }
public static void ReportError(SeverityEnum severityEnum, Exception ex, bool async = true) { if (AnalyticsEnabled) { var data = new ErrorEventData() { severity = severityEnum, message = (ex == null) ? "No exception specified." : ex.ToString(), }; if (async) Parallel.Start(() => { ReportErrorInternal(data); }); else ReportErrorInternal(data); } }
public static void Log(string issuedBy, string issuedMessage, SystemError sys, SeverityEnum severity = SeverityEnum.HIGH) { SaveLog(issuedBy, severity, sys, issuedMessage); }
public static void Log(string issuedBy, Exception ex, SystemError sys, SeverityEnum severity = SeverityEnum.HIGH) { SaveLog(issuedBy, severity, sys, GetStackTraceMessage(ex)); }
public static void ReportError(SeverityEnum severityEnum, Exception ex, bool async = true) { }
/// <summary> /// Logs an occurring error to the system. The log will actually create after a SaveChanges call. /// </summary> /// <param name="issuedBy">Issuer</param> /// <param name="issuedMsg">Message to log</param> /// <param name="severity">Severity (default = LOW)</param> /// <remarks>container.SaveChanges is required</remarks> public ErrorLog LogsError(string issuedBy, string issuedMsg, SeverityEnum severity = SeverityEnum.LOW) { return ErrorLog.LogsError(this, issuedBy, issuedMsg, severity); }
/// <summary> /// Logs an occurring error to the system. The log will actually create after a SaveChanges call. /// </summary> /// <param name="issuedBy">Issuer</param> /// <param name="issuedMsg">Message to log</param> /// <param name="severity">Severity (default = LOW)</param> /// <remarks>container.SaveChanges is required</remarks> public static ErrorLog LogsError(TransactionModelContainer container, string issuedBy, string issuedMsg, SeverityEnum severity = SeverityEnum.LOW) { var log = new ErrorLog(issuedBy, issuedMsg, severity); container.ErrorLogs.AddObject(log); return log; }
/// <summary> /// Translates Severity type to Syslog type, /// a little bit fuzzy because there are less EventLogEntryTypes /// than there are syslog Severity levels /// </summary> /// <param name="Severity">Syslog Severity level</param> /// <returns>translated EventLogEntryType</returns> private EventLogEntryType Severity2EventLogEntryType(SeverityEnum Severity) { EventLogEntryType eventLogEntryType; switch (Severity) { case SeverityEnum.emergency: eventLogEntryType = EventLogEntryType.Error; break; case SeverityEnum.alert: eventLogEntryType = EventLogEntryType.Error; break; case SeverityEnum.critical: eventLogEntryType = EventLogEntryType.Error; break; case SeverityEnum.error: eventLogEntryType = EventLogEntryType.Error; break; case SeverityEnum.warning: eventLogEntryType = EventLogEntryType.Warning; break; case SeverityEnum.notice: eventLogEntryType = EventLogEntryType.Information; break; case SeverityEnum.info: eventLogEntryType = EventLogEntryType.Information; break; case SeverityEnum.debug: eventLogEntryType = EventLogEntryType.Information; break; default: // ? eventLogEntryType = EventLogEntryType.Error; break; } return eventLogEntryType; }
public static void ReportError(SeverityEnum severityEnum, string messageText, bool async = true) { if (AnalyticsEnabled) { var data = new ErrorEventData() { severity = severityEnum, message = string.IsNullOrWhiteSpace(messageText) ? "No text specified." : messageText, }; if (async) Parallel.Start(() => { ReportErrorInternal(data); }); else ReportErrorInternal(data); } }
public static void ReportError(SeverityEnum severityEnum, Exception ex, bool async = true) { if (!MyCompilationSymbols.RenderOrGpuProfiling) { var data = new ErrorEventData() { severity = severityEnum, message = (ex == null) ? "No exception specified." : ex.ToString(), }; if (async) Parallel.Start(() => { ReportErrorInternal(data); }); else ReportErrorInternal(data); } }
public static void ReportError(SeverityEnum severityEnum, string messageText, bool async = true) { if (!MyCompilationSymbols.RenderOrGpuProfiling) { var data = new ErrorEventData() { severity = severityEnum, message = string.IsNullOrWhiteSpace(messageText) ? "No text specified." : messageText, }; if (async) Parallel.Start(() => { ReportErrorInternal(data); }); else ReportErrorInternal(data); } }