public bool Log(LogLevel logLevel, Func <string> messageFunc, Exception exception, params object[] formatParameters)
            {
                if (!PrintMessages)
                {
                    return(false);
                }

                var translatedLevel = TranslateLevel(logLevel);

                if (messageFunc == null)
                {
                    return(logger.IsEnabled(translatedLevel));
                }

                if (!logger.IsEnabled(translatedLevel))
                {
                    return(false);
                }

                if (exception != null)
                {
                    LogException(translatedLevel, messageFunc, exception, formatParameters);
                }
                else
                {
                    LogMessage(translatedLevel, messageFunc, formatParameters);
                }

                return(true);
            }
            private static Serilog.Events.LogEventLevel TranslateLevel(LogLevel logLevel)
            {
                switch (logLevel)
                {
                case LogLevel.Fatal:
                    return(Serilog.Events.LogEventLevel.Fatal);

                case LogLevel.Error:
                    return(Serilog.Events.LogEventLevel.Error);

                case LogLevel.Warn:
                    return(Serilog.Events.LogEventLevel.Warning);

                case LogLevel.Info:
                    return(Serilog.Events.LogEventLevel.Information);

                case LogLevel.Trace:
                    return(Serilog.Events.LogEventLevel.Verbose);

                default:
                    return(Serilog.Events.LogEventLevel.Debug);
                }
            }