//public async Task FatalAsync(string message) => await FatalAsync(message, null);
        //public async Task FatalAsync(string message, Exception exception) => await LogAsync(LogLevel.Fatal, message, exception);
        //-----------------------

        private void Log(LogLevel logLevel, string message, Exception exception)
        {
            if (logLevel < FileLogLevelAsEnum && logLevel < ConsoleLogLevelAsEnum)
            {
                return;
            }

            var data = new LoggingData
            {
                ConfigurationSettings = ConfigurationSettings,
                LogLevel        = logLevel,
                CurrentDateTime = DateTime.Now,
                Message         = message
            };

            var renderer = new ContentRenderer {
                LayoutData = data
            };

            //determine log file we're writing to
            var logFileFullName = LogFileManagement.SetUpLogFile(data);
            //format the string to write
            var logContent = renderer.Render(ConfigurationSettings.LogEntryLayout) + Environment.NewLine;

            if (exception != null)
            {
                logContent += $">>>Exception Message: {exception.Message}{Environment.NewLine}{exception.StackTrace}{Environment.NewLine}";
            }

            //if Console logging enabled, write to Console

            if (ConfigurationSettings.LogToConsole && logLevel >= ConsoleLogLevelAsEnum)
            {
                Console.Write(logContent);
            }

            //write/append, non locking
            if (logLevel >= FileLogLevelAsEnum)
            {
                LogFileManagement.WriteLog(logFileFullName, logContent);
            }
        }
        public static string SetUpLogFile(LoggingData data)
        {
            CreateDirIfNotExists(data.ConfigurationSettings.LogDirectory);
            var dirFullName = Path.GetFullPath(data.ConfigurationSettings.LogDirectory);
            var dirInfo     = new DirectoryInfo(dirFullName);

            if (!dirInfo.Exists)
            {
                throw new ArgumentException($"Directory {data.ConfigurationSettings.LogDirectory} not exists and/or could not be created");
            }

            DeleteOldLogFiles(data, dirFullName);

            var renderer = new ContentRenderer
            {
                LayoutData = data
            };

            var filename = renderer.Render(data.ConfigurationSettings.LogFileName);

            return(Path.Combine(data.ConfigurationSettings.LogDirectory, filename));
        }