PageRenderTime 30ms CodeModel.GetById 26ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/Dependencies/log4net/Repository/Hierarchy/DefaultLoggerFactory.cs

https://bitbucket.org/VirtualReality/software-testing
C# | 114 lines | 30 code | 8 blank | 76 comment | 2 complexity | 1048f405ee96e09bf2e154891d26df4b MD5 | raw file
  1#region Apache License
  2//
  3// Licensed to the Apache Software Foundation (ASF) under one or more 
  4// contributor license agreements. See the NOTICE file distributed with
  5// this work for additional information regarding copyright ownership. 
  6// The ASF licenses this file to you under the Apache License, Version 2.0
  7// (the "License"); you may not use this file except in compliance with 
  8// the License. You may obtain a copy of the License at
  9//
 10// http://www.apache.org/licenses/LICENSE-2.0
 11//
 12// Unless required by applicable law or agreed to in writing, software
 13// distributed under the License is distributed on an "AS IS" BASIS,
 14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15// See the License for the specific language governing permissions and
 16// limitations under the License.
 17//
 18#endregion
 19
 20using log4net.Core;
 21
 22namespace log4net.Repository.Hierarchy
 23{
 24	/// <summary>
 25	/// Default implementation of <see cref="ILoggerFactory"/>
 26	/// </summary>
 27	/// <remarks>
 28	/// <para>
 29	/// This default implementation of the <see cref="ILoggerFactory"/>
 30	/// interface is used to create the default subclass
 31	/// of the <see cref="Logger"/> object.
 32	/// </para>
 33	/// </remarks>
 34	/// <author>Nicko Cadell</author>
 35	/// <author>Gert Driesen</author>
 36	internal class DefaultLoggerFactory : ILoggerFactory
 37	{
 38		#region Internal Instance Constructors
 39
 40		/// <summary>
 41		/// Default constructor
 42		/// </summary>
 43		/// <remarks>
 44		/// <para>
 45		/// Initializes a new instance of the <see cref="DefaultLoggerFactory" /> class. 
 46		/// </para>
 47		/// </remarks>
 48		internal DefaultLoggerFactory()
 49		{
 50		}
 51
 52		#endregion Internal Instance Constructors
 53
 54		#region Implementation of ILoggerFactory
 55
 56		/// <summary>
 57		/// Create a new <see cref="Logger" /> instance
 58		/// </summary>
 59		/// <param name="repository">The <see cref="ILoggerRepository" /> that will own the <see cref="Logger" />.</param>
 60		/// <param name="name">The name of the <see cref="Logger" />.</param>
 61		/// <returns>The <see cref="Logger" /> instance for the specified name.</returns>
 62		/// <remarks>
 63		/// <para>
 64		/// Create a new <see cref="Logger" /> instance with the 
 65		/// specified name.
 66		/// </para>
 67		/// <para>
 68		/// Called by the <see cref="Hierarchy"/> to create
 69		/// new named <see cref="Logger"/> instances.
 70		/// </para>
 71		/// <para>
 72		/// If the <paramref name="name"/> is <c>null</c> then the root logger
 73		/// must be returned.
 74		/// </para>
 75		/// </remarks>
 76		public Logger CreateLogger(ILoggerRepository repository, string name) 
 77		{
 78			if (name == null)
 79			{
 80				return new RootLogger(repository.LevelMap.LookupWithDefault(Level.Debug));
 81			}
 82			return new LoggerImpl(name);
 83		}
 84
 85		#endregion
 86
 87		/// <summary>
 88		/// Default internal subclass of <see cref="Logger"/>
 89		/// </summary>
 90		/// <remarks>
 91		/// <para>
 92		/// This subclass has no additional behavior over the
 93		/// <see cref="Logger"/> class but does allow instances
 94		/// to be created.
 95		/// </para>
 96		/// </remarks>
 97		internal sealed class LoggerImpl : Logger
 98		{
 99			/// <summary>
100			/// Construct a new Logger
101			/// </summary>
102			/// <param name="name">the name of the logger</param>
103			/// <remarks>
104			/// <para>
105			/// Initializes a new instance of the <see cref="LoggerImpl" /> class
106			/// with the specified name. 
107			/// </para>
108			/// </remarks>
109			internal LoggerImpl(string name) : base(name)
110			{
111			}
112		}
113	}
114}