Exemple #1
0
        } // end method

        /// <summary>
        /// Logs an audit log entry. Checks if should be logged
        /// by looking up the filters.
        /// </summary>
        /// <param name="auditEvent">Event to log</param>
        public static void Audit(AuditEventBase auditEvent)
        {
            if (CoreGlobals.AppPreferences != null && CoreGlobals.AppPreferences.AuditLogEnable)
            {
                bool doAudit = false;

                String eventName = auditEvent.EventType.ToLower().Trim();

                if (_enableAll)
                {
                    if (!_disableFilter.Contains(eventName))
                    {
                        doAudit = true;
                    }
                }
                else
                {
                    if (_enableFilter.Contains(eventName))
                    {
                        doAudit = true;
                    }
                }

                if (doAudit)
                {
                    lock (ObjSync)
                    {
                        var sw = new StreamWriter(LogFileFullPath, true);
                        sw.WriteLine(auditEvent.ToString());
                        sw.Flush();
                        sw.Close();
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Logs an audit log entry. Checks if should be logged
        /// by looking up the filters.
        /// </summary>
        /// <param name="auditEvent">Event to log</param>
        public static void Audit(AuditEventBase auditEvent)
        {
            if (CoreGlobals.AppPreferences != null && CoreGlobals.AppPreferences.AuditLogEnable)
            {
                bool doAudit = false;

                String eventName = auditEvent.EventType.ToLower().Trim();

                if (_enableAll)
                {
                    if (!_disableFilter.Contains(eventName))
                    {
                        doAudit = true;
                    }
                }
                else
                {
                    if (_enableFilter.Contains(eventName))
                    {
                        doAudit = true;
                    }
                }

                if (doAudit)
                {
                    lock (ObjSync)
                    {
                        var sw = new StreamWriter(LogFileFullPath, true);
                        sw.WriteLine(auditEvent.ToString());
                        sw.Flush();
                        sw.Close();
                    }
                }
            }
        }