using Rowa.Lib.Log;

namespace CareFusion.Lib.StorageSystem.Logging
{
    public class WwiLogIntercept : IWwi
    {
        private IWwi baseWwiLog;

        public WwiLogIntercept(string description, string remoteAddress, ushort port)
        {
            this.baseWwiLog = LogManager.GetWwi(description, remoteAddress, port);
        }

        public void Dispose()
        {
            if (this.baseWwiLog != null)
            {
                this.baseWwiLog.Dispose();
            }
        }

        public void LogMessage(byte[] message, bool isIncommingMessage = true)
        {
            if (this.baseWwiLog != null)
            {
                this.baseWwiLog.LogMessage(message, isIncommingMessage);
            }
        }

        public void LogMessage(string message, bool isIncommingMessage = true)
        {
            if (this.baseWwiLog != null)
            {
                this.baseWwiLog.LogMessage(message, isIncommingMessage);
            }
        }

        public void LogMessage(byte[] message, int index, int length, bool isIncommingMessage = true)
        {
            if (this.baseWwiLog != null)
            {
                this.baseWwiLog.LogMessage(message, index, length, isIncommingMessage);
            }
        }
    }
}
