Ejemplo n.º 1
0
        private Host GetHost(LogEventInfo logEventInfo)
        {
            var hostId   = HostId?.Render(logEventInfo);
            var hostName = HostName?.Render(logEventInfo);
            var hostIp   = HostIp?.Render(logEventInfo);

            if (string.IsNullOrEmpty(hostId) &&
                string.IsNullOrEmpty(hostName) &&
                string.IsNullOrEmpty(hostIp))
            {
                return(null);
            }

            var host = new Host
            {
                Id   = hostId,
                Name = hostName,
                Ip   = string.IsNullOrEmpty(hostIp) ? null : new[] { hostIp }
            };

            return(host);
        }