Esempio n. 1
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception,
                                 Func <TState, Exception, string> formatter)
        {
            if (eventId == LogEventIds.ForFooter)
            {
                _analytics.FooterInfo = state?.ToString() ?? string.Empty;
            }

            // if((int)logLevel < 2)
            // {
            //     return;
            // }


            if (_name.Contains("LMPT"))
            {
                var name = _name;
                // Remove class name coming from logs triggered in UI classes.
                if (name.Contains("LMPT.Core.Server.Components.Shared"))
                {
                    name = "";
                }

                var logVm = new LogViewModel
                {
                    DateTimeFormatted = DateTime.Now.ToString("H:mm:ss"),
                    Source            = name,
                    LogLevel          = (int)logLevel,
                    Log = state?.ToString() ?? string.Empty
                };
                _analytics.AddLog(logVm);
            }
        }