예제 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initialisation des loggers
        /// </summary>
        /// <returns>un MultiLogger lié à une source fichier et console</returns>
        /// -----------------------------------------------------------------------------
        protected override BaseLogger CreateLoggers ()
        {
            var ldcConfig = new StringConfig(Args, 0);
            var xmlConfig = new XMLConfig(ConfigFile, 1);
            Configuration = new ConfigPackage();
            Configuration.AddSource(ldcConfig);
            Configuration.AddSource(xmlConfig);

            var log = new MultiLogger();
            // on utilise le référence d'un BdtGuiClient au lieu de passer directement un NotifyIcon car à ce stade
            // on ne peut pas créer de formulaire, car la Culture serait incorrecte, le fichier de configuration
            // n'étant pas déjà parsé
            ConsoleLogger = new NotifyIconLogger(CfgConsole, Configuration, this, GetType().Assembly.GetName().Name, 1);
            FileLogger = new FileLogger(CfgFile, Configuration);
            log.AddLogger(ConsoleLogger);
            log.AddLogger(FileLogger);

            return log;
        }
예제 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initialisation des loggers
        /// </summary>
        /// <returns>un MultiLogger lié à une source fichier et console</returns>
        /// -----------------------------------------------------------------------------
        protected override BaseLogger CreateLoggers()
        {
            var xmlConfig = new XMLConfig(ConfigFile, 1);
            Configuration = new ConfigPackage();
            Configuration.AddSource(xmlConfig);

            // Map the path to the current Web Application
            const string key = CfgFile + Shared.Configuration.BaseConfig.SourceItemAttribute + FileLogger.ConfigFilename;
            var filename = xmlConfig.Value(key, null);
	        if ((filename != null) && (!Path.IsPathRooted(filename)))
		        xmlConfig.SetValue(key, _server.MapPath("App_Data" + Path.DirectorySeparatorChar + filename));

	        var log = new MultiLogger();
            ConsoleLogger = new ConsoleLogger(CfgConsole, Configuration);
            FileLogger = new FileLogger(CfgFile, Configuration);
            log.AddLogger(ConsoleLogger);
            log.AddLogger(FileLogger);

            return log;
        }
예제 #3
0
파일: Program.cs 프로젝트: subTee/Bdtunnel
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Initialisation des loggers
        /// </summary>
        /// <returns>un MultiLogger lié à une source fichier et console</returns>
        /// -----------------------------------------------------------------------------
        protected virtual BaseLogger CreateLoggers ()
        {
            var ldcConfig = new StringConfig(Args, 0);
            var xmlConfig = new XMLConfig(ConfigFile, 1);
            Configuration = new ConfigPackage();
            Configuration.AddSource(ldcConfig);
            Configuration.AddSource(xmlConfig);

            var log = new MultiLogger();
            ConsoleLogger = new ConsoleLogger(CfgConsole, Configuration);
            FileLogger = new FileLogger(CfgFile, Configuration);
            log.AddLogger(ConsoleLogger);
            log.AddLogger(FileLogger);

            return log;
        }