/* * Copyright (C) 2019,2020 Dieter (coder2000) Lunn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ using System; namespace Ubiety.Logging.Core { /// /// Extensions for logger to make logging easier. /// public static class UbietyLoggerExtensions { /// /// Log a debug message. /// /// Logger to use. /// Message to log. public static void Debug(this IUbietyLogger logger, object message) { logger?.Log(LogLevel.Debug, message); } /// /// Log a debug exception. /// /// Logger to use. /// Message to log. /// Exception to log. public static void Debug(this IUbietyLogger logger, object message, Exception exception) { logger?.Log(LogLevel.Debug, message, exception); } /// /// Log a warning message. /// /// Logger to use. /// Message to log. public static void Warning(this IUbietyLogger logger, object message) { logger?.Log(LogLevel.Warning, message); } /// /// Log a warning exception. /// /// Logger to use. /// Message to log. /// Exception to log. public static void Warning(this IUbietyLogger logger, object message, Exception exception) { logger?.Log(LogLevel.Warning, message, exception); } /// /// Log an error message. /// /// Logger to use. /// Message to log. public static void Error(this IUbietyLogger logger, object message) { logger?.Log(LogLevel.Error, message); } /// /// Log an error exception. /// /// Logger to use. /// Exception to log. /// Message to log. public static void Error(this IUbietyLogger logger, Exception exception, object message) { logger?.Log(LogLevel.Error, message, exception); } /// /// Log a critical message. /// /// Logger to use. /// Message to log. public static void Critical(this IUbietyLogger logger, object message) { logger?.Log(LogLevel.Critical, message); } /// /// Log a critical exception. /// /// Logger to use. /// Message to log. /// Exception to log. public static void Critical(this IUbietyLogger logger, object message, Exception exception) { logger?.Log(LogLevel.Critical, message, exception); } /// /// Log an information message. /// /// Logger to use. /// Message to log. public static void Information(this IUbietyLogger logger, object message) { logger?.Log(LogLevel.Information, message); } /// /// Log an information exception. /// /// Logger to use. /// Message to log. /// Exception to log. public static void Information(this IUbietyLogger logger, object message, Exception exception) { logger?.Log(LogLevel.Information, message, exception); } } }