/// <summary> /// Sends a <see cref="LogMessage"/> to the server. /// </summary> /// <param name="msg">The message that as to be logged.</param> public void WriteMessage(LogMessage msg) { IAthenaWcfService ch = CreateAndOpenChannel(); ch.WriteMessage(WcfLogMessage.FromLogMessage(msg)); CloseChannel(ch); }
/// <summary> /// Retrieve the messages that have been logged after the <paramref name="startDate"/>. /// </summary> /// <param name="startDate">The minimum message date.</param> /// <returns>The list of all the message logged after the <paramref name="startDate"/>.</returns> public List <WcfLogMessage> GetMessages(DateTime?startDate) { IAthenaWcfService ch = CreateAndOpenChannel(); List <WcfLogMessage> res = ch.GetMessages(startDate); CloseChannel(ch); return(res); }
/// <summary> /// Closes the given channel. /// </summary> /// <param name="athenaChannel">The channel to be close.</param> private void CloseChannel(IAthenaWcfService athenaChannel) { IChannel ch = athenaChannel as IChannel; try { ch.Close(m_CommunicationTimeout); } catch (TimeoutException) { ch.Abort(); } }