Exemple #1
0
        /// <summary>
        /// Gets the <see cref="GlobalLogger"/> associated to the specified module.
        /// </summary>
        /// <param name="module">The module name.</param>
        /// <exception cref="ArgumentNullException">If module name is null</exception>
        /// <returns>An instance of a <see cref="Logger"/></returns>
        public static Logger GetLogger(string module)
        {
            if (module == null)
            {
                throw new ArgumentNullException("module");
            }

            Logger logger;

            lock (MapModuleNameToLogger)
            {
                if (!MapModuleNameToLogger.TryGetValue(module, out logger))
                {
                    logger = new GlobalLogger(module);
                    logger.ActivateLog(MinimumLevel);
                    MapModuleNameToLogger.Add(module, logger);
                }
            }
            return(logger);
        }
Exemple #2
0
        /// <summary>
        /// Gets the <see cref="GlobalLogger"/> associated to the specified module.
        /// </summary>
        /// <param name="module">The module name.</param>
        /// <exception cref="ArgumentNullException">If module name is null</exception>
        /// <returns>An instance of a <see cref="Logger"/></returns>
        public static Logger GetLogger(string module)
        {
            if (module == null)
                throw new ArgumentNullException("module");

            Logger logger;
            lock (MapModuleNameToLogger)
            {
                if (!MapModuleNameToLogger.TryGetValue(module, out logger))
                {
                    logger = new GlobalLogger(module);
                    logger.ActivateLog(MinimumLevel);
                    MapModuleNameToLogger.Add(module, logger);
                }
            }
            return logger;
        }