コード例 #1
0
        public void PostMessages([FromBody] ClientMessagesMessage message)
        {
            var ip = GetClientIp(this.Request);

            foreach (var msg in message.Messages)
            {
                switch (msg.Level)
                {
                case "log":
                case "debug":
                    this.Log.DebugFormat("[{3}] Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message, ip);
                    break;

                case "info":
                    this.Log.InfoFormat("[{3}] Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message, ip);
                    break;

                case "warn":
                    this.Log.WarnFormat("[{3}] Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message, ip);
                    break;

                case "error":
                    this.Log.ErrorFormat("[{3}] Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message, ip);
                    break;

                default:
                    this.Log.DebugFormat("[{4}] Time: {0}, Level: {1}, Message: ({2}x) {3}", msg.Time, msg.Level, msg.Count, msg.Message, ip);
                    break;
                }
            }
        }
コード例 #2
0
        public void PostMessages([FromBody] ClientMessagesMessage message)
        {
            foreach (var msg in message.Messages)
            {
                switch (msg.Level)
                {
                case "log":
                case "debug":
                    log.DebugFormat("Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message);
                    break;

                case "info":
                    log.InfoFormat("Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message);
                    break;

                case "warn":
                    log.WarnFormat("Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message);
                    break;

                case "error":
                    log.ErrorFormat("Time: {0}, Message: ({1}x) {2}", msg.Time, msg.Count, msg.Message);
                    break;

                default:
                    log.DebugFormat("Time: {0}, Level: {1}, Message: ({2}x) {3}", msg.Time, msg.Level, msg.Count, msg.Message);
                    break;
                }
            }
        }