Exemplo n.º 1
0
 public NLoggingService()
 {
     _logger = LogManager.GetLogger("databaseLogger");
 }
Exemplo n.º 2
0
 /// <summary>
 /// Get a logger using a class type, the logger can help write logs to different targets such as file or database. Examples, GetLogger(this.GetType()) or GetLogger(typeof(YourClassName).
 /// </summary>
 /// <param name="DeclaringType">Pls provide a class type, for example, GetLogger(this.GetType()) or GetLogger(typeof(YourClassName)</param>
 /// <returns>NLog.Logger</returns>
 public static NLog.Logger GetLogger(Type DeclaringType)
 {
     return(LogManager.GetLogger(DeclaringType.FullName));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get a logger, a type parameter is actually recommended, otherwise this method will return a logger for Core.Logging.Logger class, the actual logs will be impacted.
 /// </summary>
 /// <returns>NLog.Logger</returns>
 public static NLog.Logger GetLogger()
 {
     return(LogManager.GetCurrentClassLogger());
 }
Exemplo n.º 4
0
 /// <summary>
 /// статический конструктор.
 /// </summary>
 static Logger()
 {
     LogManager.EnableLogging();
 }