Beispiel #1
0
        public static AuditEvent CreateDebugEvent(int tenantId, int userId, string source, string userName, string message, int debugLevel, Exception exception = null)
        {
            AuditEvent auditEvent = Create(tenantId, userId, source, AuditEventTypes.Debug);

            if (!String.IsNullOrEmpty(userName))
            {
                auditEvent.Values.Add(new AuditEventValue()
                {
                    TypeID = AuditEventValueTypes.UserName, Value = userName
                });
            }
            if (!String.IsNullOrEmpty(message))
            {
                auditEvent.Values.Add(new AuditEventValue()
                {
                    TypeID = AuditEventValueTypes.Message, Value = message
                });
            }
            auditEvent.Values.Add(new AuditEventValue()
            {
                TypeID = AuditEventValueTypes.DebugLevel, Value = debugLevel
            });
            if (exception != null)
            {
                auditEvent.Values.Add(new AuditEventValue()
                {
                    TypeID = AuditEventValueTypes.Exception, Value = ExceptionModel.MapFrom(exception)
                });
            }
            return(auditEvent);
        }