示例#1
0
 public Startup(IConfiguration configuration, IWebHostEnvironment environment)
 {
     Configuration = configuration;
     LoggingLevels = configuration.GetLoggingLevels();
     _environment  = environment;
     Log.Logger    = SerilogConfiguration.CreateSerilogLogger("RestApi", LoggingLevels);
 }
        public static void Main(string[] args)
        {
            var baseConfig = GetLogConfig();

            Log.Logger = SerilogConfiguration.CreateSerilogLogger(baseConfig, AppName);
            try
            {
                Log.Information("Æô¶¯{ApplicationContext}...", AppName);
                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "{ApplicationContext} ³öÏÖ´íÎó:{messsage} !", AppName, ex.Message);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
示例#3
0
        public static void Main(string[] args)
        {
            var baseConfig = GetLogConfig();

            Log.Logger = SerilogConfiguration.CreateSerilogLogger(baseConfig, AppName);
            try
            {
                Log.Information("准备启动{ApplicationContext}...", AppName);
                var host = BuildWebHost(args);
                Log.Information("{ApplicationContext} 已启动", AppName);
                host.Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "{ApplicationContext} 出现错误:{messsage} !", AppName, ex.Message);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
示例#4
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     LoggingLevels = configuration.GetLoggingLevels();
     Log.Logger    = SerilogConfiguration.CreateSerilogLogger("TokenService", LoggingLevels);
 }