示例#1
0
        public void LogInfo(LoggingTypeModel.LogCategory logCategory, Exception exception)
        {
            if (!LoggingLevelEnabled.Decide(LoggingLevel).Info)
            {
                return;
            }

            _logger.WriteToErrorLog("INFO", logCategory, GenerateError.GetException(exception), DateTime.Now);
        }
示例#2
0
 /// <summary>
 /// Logs a new record to the Log Store as a type Error with the given String Message.
 /// </summary>
 /// <param name="logCategory"></param>
 /// <param name="message"></param>
 public static void LogInfo(LoggingTypeModel.LogCategory logCategory, string message)
 {
     try
     {
         Console.WriteLine($"{DateTime.Now} - {logCategory} - {message}");
         LoggerInterface.LogInfo(logCategory, message);
     }
     catch
     {
     }
 }
示例#3
0
 /// <summary>
 /// Logs a new record to the Log Store as a type Error with the given exception.
 /// </summary>
 /// <param name="logCategory"></param>
 /// <param name="exception"></param>
 public static void LogDebug(LoggingTypeModel.LogCategory logCategory, Exception exception)
 {
     try
     {
         Console.WriteLine($"{DateTime.Now} - {logCategory} - {exception}");
         LoggerInterface.LogDebug(logCategory, exception);
     }
     catch
     {
     }
 }
示例#4
0
        public void LogDebug(LoggingTypeModel.LogCategory logCategory, string message)
        {
            CheckArchive();

            if (!LoggingLevelEnabled.Decide(LoggingLevel).Debug)
            {
                return;
            }

            SetupLogLocation();
            _loggingFile.WriteToErrorLog("DEBUG", logCategory, message, DateTime.Now);
        }
示例#5
0
        public void LogDebug(LoggingTypeModel.LogCategory logCategory, Exception exception)
        {
            CheckArchive();

            if (!LoggingLevelEnabled.Decide(LoggingLevel).Debug)
            {
                return;
            }

            SetupLogLocation();
            _loggingFile.WriteToErrorLog("DEBUG", logCategory, GenerateError.GetException(exception), DateTime.Now);
        }
        public void LogInfo(LoggingTypeModel.LogCategory logCategory, string message)
        {
            CheckArchive();

            if (!LoggingLevelEnabled.Decide(LoggingLevel).Info)
            {
                return;
            }

            SetupLogLocation();
            _loggingFile.Write("INFO", logCategory, message, DateTime.Now);
        }
示例#7
0
        public IReadOnlyCollection <Error> ReadSpecificCategory(LoggingTypeModel.LogCategory category)
        {
            var command = "SELECT * FROM Error WHERE ErrorType = @Category ORDER BY DateTimeUTC DESC";

            var sqlitecommand = new SQLiteCommand(command, _dbConnection);

            sqlitecommand.Parameters.AddWithValue("@Category", category.ToString());

            var reader = ExecuteSqLiteNonQuery(sqlitecommand);

            return(CollectionConstructor(reader));
        }
        public void Write(string loggingLevel, LoggingTypeModel.LogCategory logCategory, string error, DateTime dateTime)
        {
            var sqlError = new Error
            {
                LoggingLevel = loggingLevel,
                DateTimeUTC  = dateTime,
                ErrorType    = logCategory.ToString(),
                Message      = error
            };

            _context.Errors.Add(sqlError);
            _context.SaveChanges();
        }
示例#9
0
        /// <summary>
        /// Returns all Logged Errors by given Log Category Type.  Not available if using the TextFile logger.
        /// </summary>
        /// <param name="logCategory"></param>
        /// <returns>IReadOnlyCollection</returns>
        public static IReadOnlyCollection <Error> Read(LoggingTypeModel.LogCategory logCategory)
        {
            var log = LogReader.ReadSpecificCategory(logCategory);

            return(log);
        }
 public IReadOnlyCollection <Error> ReadSpecificCategory(LoggingTypeModel.LogCategory category)
 {
     throw new NotImplementedException();
 }
示例#11
0
 public void WriteToErrorLog(string loggingLevel, LoggingTypeModel.LogCategory logCategory, string error, DateTime dateTime)
 {
     ExecuteSqLiteNonQuery($"INSERT INTO Error VALUES(NULL,'{loggingLevel}','{logCategory}','{error}','{dateTime:yyyy-MM-dd HH:mm:ss}')");
 }