mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2024-11-09 23:44:20 +01:00
41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
using System;
|
|
using System.IO;
|
|
using Serilog;
|
|
using Serilog.Formatting.Json;
|
|
using Serilog.Sinks.SystemConsole.Themes;
|
|
using SharpRss.Models;
|
|
using ToolQit;
|
|
using ToolQit.Containers;
|
|
using WebSharpRSS.Models;
|
|
|
|
namespace WebSharpRSS
|
|
{
|
|
public static class Bootstrapper
|
|
{
|
|
public static void SetAppDefaultSettings(this DataContainer dataCon)
|
|
{
|
|
var paths = dataCon["Paths"];
|
|
//paths.Set("FaviconResolveUrl", "https://icons.duckduckgo.com/ip3/{0}.ico", false);
|
|
paths.Set("FaviconResolveUrl", "http://www.google.com/s2/favicons?domain={0}", false);
|
|
paths.Set("LogPath", Path.Combine(Environment.CurrentDirectory, "logs", "log_.json"), false);
|
|
|
|
var dbSql = dataCon["SQL"];
|
|
dbSql.Set("Host", "localhost", false);
|
|
dbSql.Set("Port", "6969", false);
|
|
dbSql.Set("Username", "sharpUser", false);
|
|
dbSql.Set("Password", "sh@rP@s$", false);
|
|
}
|
|
|
|
private static LoggerConfiguration? _configuration;
|
|
public static void SetupLogging()
|
|
{
|
|
if (_configuration != null) return;
|
|
_configuration = new LoggerConfiguration()
|
|
.WriteTo.Console()
|
|
.WriteTo.File(new JsonFormatter(), Caretaker.Settings["Paths"].GetString("LogPath"), rollingInterval: RollingInterval.Day)
|
|
.MinimumLevel.Verbose();
|
|
|
|
Log.Logger = _configuration.CreateLogger();
|
|
}
|
|
}
|
|
} |