Exemple #1
0
        /// <summary>
        /// Records a fully specified <see cref="FlightEvent" />.
        /// </summary>
        /// <param name="flightEvent"></param>
        public void Log(FlightEvent flightEvent)
        {
            try
            {
                if (flightEvent.Operation == null)
                {
                    flightEvent.Operation = "[not set]";
                }

                lock (syncLock)
                {
                    if (!isRunning || !isEnabled)
                    {
                        return;
                    }

                    if (IsPassThruMode)
                    {
                        passThruCallback(flightEvent);
                        return;
                    }

                    if (this.maxEvents <= 0)
                    {
                        return;
                    }

                    while (this.events.Count >= this.maxEvents)
                    {
                        this.events.Dequeue();
                    }

                    this.events.Enqueue(flightEvent);
                    this.isDirty = true;

                    if (this.autoFlush)
                    {
                        Save();
                    }
                }
            }
            catch
            {
                // Ignore errors
            }
        }
Exemple #2
0
        /// <summary>
        /// Logs an object implementing <see cref="IFlightEventInfo" />
        /// with a failure indication.
        /// </summary>
        /// <param name="eventInfo">The event information.</param>
        /// <param name="isError">Indicates whether the operation succeeded or failed.</param>
        public void Log(IFlightEventInfo eventInfo, bool isError)
        {
            FlightEvent flightEvent;

            flightEvent                = new FlightEvent();
            flightEvent.TimeUtc        = SysTime.ExternalNow;
            flightEvent.OrganizationID = this.OrganizationID;
            flightEvent.UserID         = this.UserID;
            flightEvent.SessionID      = this.SessionID;
            flightEvent.Source         = this.Source;
            flightEvent.SourceVersion  = this.SourceVersion;
            flightEvent.Operation      = eventInfo.SerializeOperation();
            flightEvent.IsError        = isError;
            flightEvent.Details        = eventInfo.SerializeDetails();

            Log(flightEvent);
        }
Exemple #3
0
 /// <summary>
 /// Unserializes the operation and details from a <see cref="FlightEvent" />
 /// into the current instance.
 /// </summary>
 /// <param name="flightEvent">The event being deseralized.</param>
 /// <exception cref="NotImplementedException">This class does not implement this method.</exception>
 public void Deserialize(FlightEvent flightEvent)
 {
     throw new NotImplementedException();
 }