예제 #1
0
        private Agent GetAgent(LogEventInfo logEventInfo)
        {
            var agentId      = AgentId?.Render(logEventInfo);
            var agentName    = AgentName?.Render(logEventInfo);
            var agentType    = AgentType?.Render(logEventInfo);
            var agentVersion = AgentVersion?.Render(logEventInfo);

            if (string.IsNullOrEmpty(agentId) &&
                string.IsNullOrEmpty(agentName) &&
                string.IsNullOrEmpty(agentType) &&
                string.IsNullOrEmpty(agentVersion))
            {
                return(null);
            }

            var agent = new Agent
            {
                Id      = agentId,
                Name    = agentName,
                Type    = agentType,
                Version = agentVersion
            };

            return(agent);
        }