/// <summary> /// Get a logger based on its name. /// </summary> /// <param name="name">name of the logger</param> /// <param name="plant">the log plant responsible for creating the said logger.</param> /// <returns>logger if found, or newly created logger if not found</returns> public ILogger GetLogger(string name, ILogPlant plant) { if (name == null) { throw new ArgumentNullException("name"); } if (plant == null) { throw new ArgumentNullException("plant"); } LoggerHash hash = new LoggerHash(name); lock (this.v_rankTable) { Logger logger = this.v_rankTable[hash] as Logger; if (logger == null) { logger = plant.GrowLogger(name); logger.Rank = this; this.InformParents(logger); lock (this) { this.v_rankTable[hash] = logger; } //this.OnLoggerCreatedEvent(logger); return(logger); } return(logger); } }
/// <summary> /// ctor /// </summary> /// <param name="logplant"></param> public Ranks(ILogPlant logplant) { this.v_defaultplant = logplant; this.v_rankTable = new Dictionary <LoggerHash, ILogger>(); this.LevelCollection = new LevelCollection(); this.v_configurationChanged = this.LoadConfiguration; }
/// <summary> /// ctor /// </summary> /// <param name="logplant"></param> /// <param name="properties"></param> public Ranks(ILogPlant logplant, PropertyHash properties) : this(logplant) { this.v_properties = properties; }