/// <summary> /// 使用一个明确的文件路径,若只有文件名则用默认 /// </summary> /// <param name="configuration">配置</param> /// <param name="fileName"></param> /// <param name="directoryName"></param> public FileLogger(string fileName, string directoryName, LogConfiguration configuration) { SetId(); _configuration = configuration; FileName = fileName; DirectoryName = directoryName; }
//单个日志文件最大5M public LogEntity(LogConfiguration configuration, string dictionaryName, string fileName) { StringBuilder = new StringBuilder(1024); Configuration = configuration; DictionaryName = dictionaryName; FileName = fileName; CreateTime = DateTime.Now; LastWriteTime = DateTime.Now; }
/// <summary> /// 使用默认跟 /// </summary> /// <param name="useDefaultRoot"></param> /// <param name="paths"></param> /// <returns></returns> public ILogger Create(bool useDefaultRoot, LogConfiguration configuration, params string[] paths) { if (paths == null) { throw new ArgumentNullException("paths"); } if (!paths.Any()) { throw new Exception("至少输入一个路径"); } var logPath = ""; if (useDefaultRoot) { logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Constants.DefaultLogDirectory); } logPath = paths.Aggregate(logPath, Path.Combine); return(InternalCreate(logPath, configuration)); }
private ILogger InternalCreate(string name, LogConfiguration configuration) { return(new FileLogger(name, configuration)); }
/// <summary> /// Creates a new FileLogger for the given full name. /// </summary> /// <param name="name"></param> /// <param name="configuration"></param> /// <returns></returns> public ILogger Create(string name, LogConfiguration configuration) { return(InternalCreate(name, configuration)); }
public FileLoggerProvider(LogConfiguration configuration) { Configuration = configuration; }
public EmptyLogger() { Configuration = new LogConfiguration(); }
public FileLogger(string logPath, LogConfiguration configuration) { SetId(); _configuration = configuration; Init(logPath); }
/// <summary> /// Creates a new FileLogger for the given full name. /// </summary> /// <param name="name"></param> /// <param name="configuration"></param> /// <returns></returns> public ILogger Create(string name, LogConfiguration configuration) { return(_fileLoggerProvider.Create(name, configuration)); }
public FileLoggerFactory() { var configuration = new LogConfiguration(); _fileLoggerProvider = new FileLoggerProvider(configuration); }