ningshuxia
2023-02-21 594ffae0e1d16811c387b1c4ddb4d867fd7ae251
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using IStation.Untity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.DataDockingSocket
{
    /// <summary>
    /// 生成调试信息辅助类
    /// </summary>
    internal class LogCustomHelper
    {
 
        private const string _logNameDebug = "socket-zjs-debug";
 
        /// <summary>
        /// 生成调试信息辅助类
        /// </summary>
        public static void Debug(List<Model.MonitorDataDockingReceiveRecord> rece_list)
        {
            if (rece_list == null || rece_list.Count < 1)
                return;
            var json = JsonHelper.Object2Json(rece_list);
            LogHelper.Custom(_logNameDebug, json);
        }
 
        /// <summary>
        /// 生成调试信息辅助类
        /// </summary>
        public static void Debug(List<Model.MonitorDataDockingSrcRecord> rece_list)
        {
            if (rece_list == null || rece_list.Count < 1)
                return;
            var json = JsonHelper.Object2Json(rece_list);
            LogHelper.Custom(_logNameDebug, json);
        }
 
 
        public static void Debug(string msg)
        {
            LogHelper.Custom(_logNameDebug, msg);
        }
 
        private const string _logNameSrc = "socket-zjs-src";
 
        /// <summary>
        /// 生成
        /// </summary>
        public static void Src(byte[] bts)
        {
            if (bts == null || bts.Count() < 1)
                return;
 
            var message_bts = BitTransfer.ToString(bts);
            LogHelper.Custom(_logNameSrc, message_bts);
        }
 
        private const string _logNameInfo = "socket-zjs-info";
 
        /// <summary>
        /// 生成
        /// </summary>
        public static void Info(string msg)
        {
            if (string.IsNullOrEmpty(msg))
                return;
 
            LogHelper.Custom(_logNameInfo, msg);
        }
 
        private const string _logNameError = "socket-zjs-error";
 
        /// <summary>
        /// 生成
        /// </summary>
        public static void Error(string msg, Exception ex = null)
        {
            if (string.IsNullOrEmpty(msg))
                return;
            if (ex == null)
                LogHelper.Custom(_logNameError, msg);
            else
                LogHelper.Custom(_logNameError, string.Format("msg:{0}, ex:{1}", msg, ex.StackTrace));
        }
 
    }
}