Exemplo n.º 1
0
        public static void LogMsg(this ITideLogger logger, string message, AuthenticationModel model = null, Exception ex = null)
        {
            var tideLog = new TideLog()
            {
                Data = JsonConvert.SerializeObject(new {
                    Data              = model,
                    Exception         = ex,
                    HashedUsername    = model?.Username,
                    ConvertedUsername = model?.Username?.ConvertToUint64(),
                    UserIp            = model?.Ip
                }),
                Message      = message,
                TideLogLevel = ex == null ? TideLogLevel.Information : TideLogLevel.Error
            };

            logger.Log(tideLog);
        }
        public async void Log(TideLog log)
        {
            log.Identifier = _settings.Identifier;
            var json        = JsonConvert.SerializeObject(log);
            var httpContent = new StringContent(json, Encoding.UTF8, "application/json");

            using (var httpClient = new HttpClient()
            {
                BaseAddress = new Uri(_settings.Connection)
            })
            {
                // Error here
                var httpResponse = await httpClient.PostAsync("/log", httpContent);

                if (httpResponse.Content != null)
                {
                    // Error Here
                    var responseContent = await httpResponse.Content.ReadAsStringAsync();
                }
            }
        }
 public void Log(TideLog log)
 {
     log.DateTime = DateTime.Now;
     _context.Add(log);
     _context.SaveChanges();
 }
 public void Log(TideLog log)
 {
     _logger.Log(log);
 }
Exemplo n.º 5
0
 public void Log(TideLog log)
 {
     _context.Add(log);
     _context.SaveChanges();
 }