/// <summary> /// Default constructor /// </summary> /// <param name="path">Path to log to</param> /// <param name="configuration">The configuration to use</param> public FileLoggerProvider(string path, FileLoggerConfiguration configuration) { // Set the configuration this.configuration = configuration; // Set the path this.filePath = path; }
/// <summary> /// Default constructor /// </summary> /// <param name="categoryName">The category of this logger</param> /// <param name="filePath">The file path to write to</param> /// <param name="configuration">The configuration to use</param> public FileLogger(string categoryName, string filePath, FileLoggerConfiguration configuration) { // Get absolute path filePath = Path.GetFullPath(filePath); // Set members this.categoryName = categoryName; this.filePath = filePath; this.configuration = configuration; }
/// <summary> /// Adds a new file logger to the specific path /// </summary> /// <param name="builder">The log builder to add to</param> /// <param name="path">The path where to write to</param> /// <returns></returns> public static ILoggingBuilder AddFile(this ILoggingBuilder builder, string path, FileLoggerConfiguration configuration = null) { // Add file log provider to builder builder.AddProvider(new FileLoggerProvider(path, configuration ?? new FileLoggerConfiguration())); // Return the builder return(builder); }