using System; namespace Asterisk.NET.Manager.Event { /// /// A LogChannelEvent is triggered when logging is turned on or off.
/// It is implemented in logger.c
///
public class LogChannelEvent : ManagerEvent { private bool enabled; private string reason; private int reasonCode; /// /// Get/Set if logging has been enabled or disabled. /// public bool Enabled { get { return enabled; } set { this.enabled = value; } } /// /// Get the textual representation of the reason for disabling logging. /// public string Reason { get { return this.reason; } set { reason = ""; reasonCode = 0; if (string.IsNullOrEmpty(value)) return; int spaceIdx; if ((spaceIdx = value.IndexOf(' ')) <= 0) spaceIdx = value.Length; int.TryParse(value.Substring(0, spaceIdx), out this.reasonCode); if (value.Length > spaceIdx + 3) this.reason = value.Substring(spaceIdx + 3, value.Length - spaceIdx + 3); } } /// /// Get the reason code for disabling logging. /// public int ReasonCode { get { return this.reasonCode; } } public LogChannelEvent(ManagerConnection source) : base(source) { } } }