예제 #1
0
        private static EventResponse LogPayload(EventRequest eventRequest)
        {
            var resp = new EventResponse();

            var userName = AuthIntegration.HasClaims() ? AuthIntegration.GetOperator().UserName : null;

            if (string.IsNullOrEmpty(userName))
            {
                return(resp);
            }

            //[DATE TIME] [SEVERITY] [APPLICATION] [METHOD] DETAIL
            try
            {
                //LogManager.SetLogicalContextProperty(LogProperties.ApplicationName, $"{eventRequest.Source}");

                foreach (var payload in eventRequest.Payload)
                {
                    logger.Info(Environment.NewLine + payload.Data);
                }
            }
            catch
            {
                throw new Exception("Event could not be logged");
            }

            return(resp);
        }
예제 #2
0
        private static EventResponse Log(EventRequest eventRequest)
        {
            var resp = new EventResponse();

            var userName = AuthIntegration.HasClaims() ? AuthIntegration.GetOperator().UserName : null;

            if (string.IsNullOrEmpty(userName))
            {
                return(resp);
            }

            //[DATE TIME] [SEVERITY] [APPLICATION] [METHOD] DETAIL
            try
            {
                //LogManager.SetLogicalContextProperty(LogProperties.ApplicationName, $"{eventRequest.Source}");
                var jsonString = JsonProcessor.SerializeObject(eventRequest.Payload);
                var strLog     = $"Msg='{jsonString}'";

                logger.Info(strLog);
            }
            catch
            {
                throw new Exception("Event could not be logged");
            }

            return(resp);
        }