public void ConfigureAllTarget_Configures_All_Logs_Target()
        {
            var loggingConfiguration = new LoggingConfiguration();

            loggingConfiguration.ConfigureAllTarget();

            loggingConfiguration.ConfiguredNamedTargets.Count.Should().Be(1);
            loggingConfiguration.LoggingRules.Count.Should().Be(1);
            loggingConfiguration.ConfiguredNamedTargets[0].Should().BeOfType(typeof(FileTarget));

            FileTarget allLogsTarget = (FileTarget)loggingConfiguration.ConfiguredNamedTargets[0];

            allLogsTarget.MaxArchiveFiles.Should().Be(3);
        }
        /// <summary>
        /// Creates LoggingConfiguration for NLog based on hosting environment
        /// </summary>
        /// <param name="env">Current hosting environment of the application</param>
        /// <param name="logConfiguration">[optional] Custom configuration for the application</param>
        public static LoggingConfiguration CreateConfiguration(IHostingEnvironment env, ILogConfiguration logConfiguration = null)
        {
            NLogConfiguration nLogConfig = SetUpNLogConfig(env, logConfiguration);

            var loggingConfiguration = new LoggingConfiguration();

            string basePath     = PlatformServices.Default.Application.ApplicationBasePath;
            string logDirectory = $"{basePath}/{GetLogDirectory(env, nLogConfig)}";

            loggingConfiguration.Variables["appName"]      = nLogConfig.AppName;
            loggingConfiguration.Variables["logDirectory"] = logDirectory;

            if (nLogConfig.EnableAllLogs)
            {
                loggingConfiguration.ConfigureAllTarget();
            }

            if (nLogConfig.EnableWebLogs)
            {
                loggingConfiguration.ConfigureFileTarget(GetEnvironmentName(env), logConfiguration);
            }

            return(loggingConfiguration);
        }