/// <summary> /// Enables SimpleLog framework /// </summary> /// <param name="services"></param> /// <param name="configuration"></param> public static void AddSimpleLog(this IServiceCollection services) { //Logging to console by default var options = new LogBuilder(); options.AddConsoleTarget(); services.AddSingleton(options); services.AddScoped <SimpleLogger>(); }
/// <summary> /// Enables SimpleLog framework /// </summary> /// <param name="services"></param> /// <param name="configuration"></param> public static void AddSimpleLog(this IServiceCollection services, Action <LogBuilder> configuration) { var options = new LogBuilder(); configuration(options); services.AddSingleton(options); //If not targets are added during configuration //add a default console target if (!options.LogTargets.Any()) { options.AddConsoleTarget(); } services.AddTransient <ILogger, SimpleLogger>(); }