public ApiBaseLog GenerateBaseLog(ApiLogType logtype, string message, Type currentClass, string currentMethod, string dbConnectionString, Exception ex = null)
 {
     return new ApiBaseLog
     {
         LoggingType = logtype,
         ConnectionString = dbConnectionString,
         Message = message,
         CurrentClass = currentClass,
         CurrentMethod = currentMethod,
         Exception = ex
     };
 }
        public void GenerateBaseLog(ApiLogType logtype, string message, Type currentClass, string currentMethod, Exception ex = null)
        {

            var baseLog = _loggingService.GenerateBaseLog(logtype, message, currentClass, currentMethod,
                _db.Database.Connection.ConnectionString, ex);

            Request.Properties["LoggingInfo"] = baseLog;


        }
        public void WriteLog(ApiLogType logtype, ApiLogEntry log, Exception ex)
        {
            switch (logtype)
            {
                case ApiLogType.Information:
                    Log.Logger.Information(log.Message + " {@ApiLogEntry}", log, ex);
                    break;
                case ApiLogType.Error:
                    Log.Logger.Error(log.Message + " {@ApiLogEntry}{@Exception}", log, ex);
                    break;
                case ApiLogType.Warning:
                    Log.Logger.Warning(log.Message + " {@ApiLogEntry}{@Exception}", log, ex);
                    break;
                case ApiLogType.Fatal:
                    Log.Logger.Fatal(log.Message + " {@ApiLogEntry}{@Exception}", log, ex);
                    break;
                case ApiLogType.Debug:
                    Log.Logger.Debug(log.Message + " {@ApiLogEntry}{@Exception}", log, ex);
                    break;
                case ApiLogType.Verbose:
                    Log.Logger.Verbose(log.Message + " {@ApiLogEntry}{@Exception}", log, ex);
                    break;
                default:
                    Log.Logger.Fatal("Can't identify a logging type!!!!" + " {@ApiLogEntry}", log);
                    break;

            }


            Log.CloseAndFlush();
            return;
        }