SimpleLogger.SimpleLog.SetLogFile C# (CSharp) Method

SetLogFile() public static method

Set all log properties at once
Set all log customizing properties at once. This is a pure convenience function. All parameters are optional. When logDir is set and it cannot be created or writing a first entry fails, no exception is thrown, but the previous directory, respectively the default directory (the current working directory), is used instead.
public static SetLogFile ( string logDir = null, string prefix = null, string suffix = null, string extension = null, string dateFormat = null, Severity logLevel = null, bool startExplicitly = null, bool check = true, bool writeText = null, string textSeparator = null ) : Exception
logDir string for details. When null is passed here, is not set. Here, is created, when it does not exist.
prefix string for details. When null is passed here, is not set.
suffix string for details. When null is passed here, is not set.
extension string for details. When null is passed here, is not set.
dateFormat string for details. When null is passed here, is not set.
logLevel Severity for details. When null is passed here, is not set.
startExplicitly bool for details. When null is passed here, is not set.
check bool Whether to call , i.e. whether to write a test entry after setting the new log file. If true, the result of is returned.
writeText bool for details. When null is passed here, is not set.
textSeparator string for details. When null is passed here, is not set.
return System.Exception
        public static Exception SetLogFile(string logDir = null, string prefix = null, string suffix = null, string extension = null, string dateFormat = null, Severity? logLevel = null, bool? startExplicitly = null, bool check = true, bool? writeText = null, string textSeparator = null)
        {
            Exception result = null;

            try
            {
                if(writeText != null)
                    WriteText = writeText.Value;

                if(textSeparator != null)
                    TextSeparator = textSeparator;

                if(logLevel != null)
                    LogLevel = logLevel.Value;

                if(extension != null)
                    Extension = extension;

                if(suffix != null)
                    Suffix = suffix;

                if(dateFormat != null)
                    DateFormat = dateFormat;

                if(prefix != null)
                    Prefix = prefix;

                if(startExplicitly != null)
                    StartExplicitly = startExplicitly.Value;

                if(logDir != null)
                    result = SetLogDir(logDir, true);

                // Check if logging works with new settings
                if(result == null && check)
                    result = Check();
            }
            catch(Exception ex)
            {
                result = ex;
            }

            return result;
        }