Exemple #1
0
        public async Task InvokeAsync(HttpContext context)
        {
            await _next(context);

            var routeData = context.GetRouteData();

            if (routeData.Values["action"] != null)
            {
                ControllerMessage msg = new ControllerMessage
                                        (
                    dateTime: DateTime.Now,
                    ip: context.Connection.RemoteIpAddress.ToString(),
                    service: Assembly.GetExecutingAssembly().GetName().Name,
                    route: context.Request.Path.ToString(),
                    controller: routeData.Values["controller"].ToString(),
                    action: routeData.Values["action"].ToString(),
                    identity: context.User.Identity.Name ?? "Unidentified",
                    status: context.Response.StatusCode
                                        );
                await _kafkaLogger.WriteLogAsync();
            }
        }
Exemple #2
0
 public void LogManagerLogin(int id, string email, string role)
 {
     _ = _logger.WriteLogAsync(MANAGER_LOGIN, DateTime.Now.ToString("s"), id.ToString(), email, role);
 }