Added container accessor to Castle.Core
[castle.git] / Core / Castle.Core / Logging / Factories / AbstractExtendedLoggerFactory.cs
blob3185da3e7c86e63d215b464bb0100eb84e757ce5
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Core.Logging.Factories
17 using System;
18 using System.IO;
20 public abstract class AbstractExtendedLoggerFactory : MarshalByRefObject, IExtendedLoggerFactory
22 #region IExtendedLoggerFactory Members
24 /// <summary>
25 /// Creates a new extended logger, getting the logger name from the specified type.
26 /// </summary>
27 public virtual IExtendedLogger Create(Type type)
29 if (type == null) throw new ArgumentNullException("type");
31 return Create(type.FullName);
34 /// <summary>
35 /// Creates a new extended logger.
36 /// </summary>
37 public abstract IExtendedLogger Create(string name);
39 /// <summary>
40 /// Creates a new extended logger, getting the logger name from the specified type.
41 /// </summary>
42 public virtual IExtendedLogger Create(Type type, LoggerLevel level)
44 if (type == null) throw new ArgumentNullException("type");
46 return Create(type.FullName, level);
49 /// <summary>
50 /// Creates a new extended logger.
51 /// </summary>
52 public abstract IExtendedLogger Create(string name, LoggerLevel level);
54 #endregion
56 #region ILoggerFactory Members
58 /// <summary>
59 /// Creates a new logger, getting the logger name from the specified type.
60 /// </summary>
61 ILogger ILoggerFactory.Create(Type type)
63 return Create(type);
66 /// <summary>
67 /// Creates a new logger.
68 /// </summary>
69 ILogger ILoggerFactory.Create(string name)
71 return Create(name);
74 /// <summary>
75 /// Creates a new logger, getting the logger name from the specified type.
76 /// </summary>
77 ILogger ILoggerFactory.Create(Type type, LoggerLevel level)
79 return Create(type, level);
82 /// <summary>
83 /// Creates a new logger.
84 /// </summary>
85 ILogger ILoggerFactory.Create(string name, LoggerLevel level)
87 return Create(name, level);
90 #endregion
92 /// <summary>
93 /// Gets the configuration file.
94 /// </summary>
95 /// <param name="filename">i.e. log4net.config</param>
96 /// <returns></returns>
97 protected FileInfo GetConfigFile(string filename)
99 FileInfo result;
101 if (Path.IsPathRooted(filename))
103 result = new FileInfo(filename);
105 else
107 result = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename));
110 return result;