public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)

        .ConfigureLogging((Logging) =>
        {
            Logging.AddDebug();
            Logging.AddConsole();
        })
        .UseStartup <Startup>();
예제 #2
0
        public static void Main(string[] s)
        {
            try {
                Logging.AddDebug(new ConsoleDebug());
                Logging.setLevel(Logging.Level.DEBUG);

                System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
                stopwatch.Start();

                TestClient tc = new TestClient();
                tc.MultipleTest();

                stopwatch.Stop();
                TimeSpan timespan = stopwatch.Elapsed;

                Logging.LogInfo("time: " + timespan.TotalMilliseconds + "(ms)");
            } catch (Exception ex) {
                Logging.LogError(ex.ToString());
            }
        }
예제 #3
0
        //want to test on console, you can change MainStart to Main and build as exe.
        public static void MainStart(String[] args)
        {
            Logging.AddDebug(new ConsoleDebug());
            Logging.setLevel(Logging.Level.INFO);

            ChatRoomClient room = ChatRoomClient.getInstance();

            try {
                room.init();
                room.login();
                Console.WriteLine("┌-- enter room --┐");
                while (room.sent())
                {
                    room.display();
                }
                Console.WriteLine("└-- exit room --┘");
            } catch (Exception e) {
                Logging.LogError(e);
            }
        }
예제 #4
0
        public static IWebHostBuilder CreateHostBuilder(string[] args)
        {
            var buider = new WebHostBuilder()
                         .UseKestrel()
                         .UseStartup <Startup>()
                         .UseContentRoot(Directory.GetCurrentDirectory())
                         .ConfigureAppConfiguration((hostingContext, config) =>
            {
                var env = hostingContext.HostingEnvironment;
                config.AddJsonFile("appsettings.json", true, true)
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);
                //if (env.IsDevelopment())
                //{
                //    var appAssembly = Assembly.Load(new AssemblyName(env.EnvironmentName));
                //    if (appAssembly != null)
                //    {
                //        config.AddUserSecrets(appAssembly, true);
                //    }
                //}
                config.AddEnvironmentVariables();
                if (args != null)
                {
                    config.AddCommandLine(args);
                }
            })
                         .ConfigureLogging((hostingContext, Logging) =>
            {
                Logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
                Logging.AddConsole();
                Logging.AddDebug();
            })
                         .UseIISIntegration()
                         .UseDefaultServiceProvider((Context, Options) =>
            {
                Options.ValidateScopes = Context.HostingEnvironment.IsDevelopment();
            });

            return(buider);
        }