Example #1
0
 internal void Setup()
 {
     LoggerFactory = new LoggerFactory();
     LoggerFactory.AddNLog().ConfigureNLog(NlogConfigFile);
     Logger    = LoggerFactory.CreateLogger("Chat.Client.Console");
     Cmdlogger = LoggerFactory.CreateLogger("Chat.Client.Console.Commands");
     GrpcConnectionExtension.SetLogger(LoggerFactory);
     Builder = new ClientBuilder()
               .UseLoggerFactory(LoggerFactory)
               .UseGrpc(copt.ServerAddress, copt.Host, copt.Port);
 }
Example #2
0
        internal override void Execute(Program app)
        {
            var lf = new LoggerFactory();

            lf.AddNLog().ConfigureNLog(Program.NlogConfigFile);
            app._logger    = lf.CreateLogger("Chat.Server.Console");
            app._cmdlogger = lf.CreateLogger("Chat.Server.Console.Commands");
            GrpcConnectionExtension.SetLogger(lf);

            app.consoleOption = this;
            var builder = new ServerBuilder()
                          .UseLoggerFactory(lf)
                          .UseGrpc(Host, Port);

            if (Database == DbType.InMemory)
            {
                builder.UseInMemory();
            }
            else if (Database == DbType.SQLite)
            {
                builder.UseSQLite(SQLiteString);
            }
            app.server = builder.Build();
        }