Ejemplo n.º 1
0
        private static string CallMethod(CommunicationLogEntryType Type)
        {
            switch (Type)
            {
            case CommunicationLogEntryType.Error:
                return("ERROR");

            case CommunicationLogEntryType.Info:
                return("INFO");

            case CommunicationLogEntryType.Request:
                return("REQUEST");

            case CommunicationLogEntryType.Response:
                return("RESPONSE");

            case CommunicationLogEntryType.Rejected:
                return("REJECTED");

            case CommunicationLogEntryType.Warning:
                return("WARNING");

            case CommunicationLogEntryType.Timer:
                return("TIMER");

            default:
                return("UNKNOWN");
            }
        }
Ejemplo n.º 2
0
        public static void RecordEntry(string ID, string CAT, CommunicationLogEntryType TYPE, ICommunicationLogData DATA)
        {
            try
            {
                if (!Directory.Exists(Strings.Encode(Locations.LogCurrentFolder)))
                {
                    Directory.CreateDirectory(Strings.Encode(Locations.LogCurrentFolder));
                }
            }
            catch { }

            try
            {
                CommunicationLogEntry Entry = new CommunicationLogEntry
                {
                    ServerId   = ID,
                    Category   = CAT,
                    Data       = DATA,
                    Type       = CallMethod(TYPE),
                    RecordedAt = Time.GetTime("Now - UTC Time (Offset)")
                };

                File.AppendAllLines(Locations.LogCommunication, new List <string>
                {
                    JsonConvert.SerializeObject(Entry, Formatting.Indented)
                });
            }
            catch (Exception Error)
            {
                LogToFileAddons.OpenLog("Communication", null, Error, null, true);
            }
        }
Ejemplo n.º 3
0
        public static void RecordEntry(string serverId, string category, CommunicationLogEntryType type,
                                       ICommunicationLogData data)
        {
            CommunicationLogEntry entry = new CommunicationLogEntry {
                ServerId = serverId, Category = category, Data = data, Type = type, RecordedAt = DateTimeOffset.Now
            };

            File.AppendAllLines(LogFileName, new List <string>
            {
                JsonConvert.SerializeObject(entry, Formatting.Indented)
            });
        }