Example #1
0
        /// <summary>
        /// Creates a logger for a category or retrieves it from the cache.
        /// </summary>
        /// <param name="category">Category to create a logger for</param>
        /// <returns></returns>
        internal Logger GetLogger(string category)
        {
            Logger logger;

            lock (_loggerCache)
            {
                if (_loggerCache.TryGetValue(category, out logger))
                {
                    return(logger);
                }

                _logAdministrator.GetLogLevel(out var logLevel);

                var logExecutor = new LogExecutor(category, this);
                logger = new Logger(logExecutor);
                logger.SetupLogLevel(logLevel);
                _loggerCache.Add(category, logger);
            }

            return(logger);
        }
Example #2
0
File: Logger.cs Project: najlot/Log
 internal Logger(LogExecutor logExecutor)
 {
     _logExecutor = logExecutor;
 }