Exemple #1
0
        public static void AuditException(IAuditor auditor, Exception exception, AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
        {
            if (!auditor.IsAuditEnabled(level, context))
            {
                return;
            }

            VfsException vfsException = exception as VfsException;

            if (vfsException != null)
            {
                //don't create duplicate or unneccessary entries
                if (vfsException.IsAudited || vfsException.SuppressAuditing)
                {
                    return;
                }
            }

            if (String.IsNullOrEmpty(message))
            {
                message = exception.ToString();
            }
            else
            {
                message = String.Format("{0}\n\n{1}", message, exception);
            }

#if !SILVERLIGHT
            if (exception.StackTrace == null)
            {
                //add stack trace, if not available yet
                message = String.Format("{0}\n{1}", message, Environment.StackTrace);
            }
#endif

            //submit incident
            auditor.Audit(level, context, eventId, message);

            //set audition flag
            if (vfsException != null)
            {
                vfsException.IsAudited = true;
            }
        }
Exemple #2
0
 public static bool IsCrititcalEnabledFor(IAuditor auditor, FileSystemTask task)
 {
     return(auditor.IsAuditEnabled(AuditLevel.Critical, task));
 }
Exemple #3
0
 public static bool IsWarnEnabledFor(IAuditor auditor, FileSystemTask task)
 {
     return(auditor.IsAuditEnabled(AuditLevel.Warning, task));
 }
Exemple #4
0
 public static bool IsInfoEnabledFor(IAuditor auditor, FileSystemTask task)
 {
     return(auditor.IsAuditEnabled(AuditLevel.Info, task));
 }