Ejemplo n.º 1
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);
            }
        }
        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)
            });
        }