예제 #1
0
        public static int Main(string[] args)
        {
            IServiceProvider serviceProvider = null;

            try {
                serviceProvider = JobServiceProvider.GetServiceProvider();

                int result = JobCommands.Run(args, serviceProvider, app => {
                    app.JobConfiguration.Assemblies = new List <string> {
                        "Exceptionless.Core", "Foundatio"
                    };
                });

                return(result);
            } catch (Exception ex) {
                Log.Fatal(ex, "Job terminated unexpectedly");
                return(1);
            } finally {
                Log.CloseAndFlush();
                if (serviceProvider is IDisposable disposable)
                {
                    disposable.Dispose();
                }

                ExceptionlessClient.Default.ProcessQueue();
            }
        }
예제 #2
0
        public static int Main(string[] args)
        {
            var loggerFactory = new LoggerFactory().AddConsole();

            var getServiceProvider = new Func <IServiceProvider>(() => {
                var container = new Container();
                container.RegisterInstance(loggerFactory);
                container.RegisterSingleton(typeof(ILogger <>), typeof(Logger <>));

                return(container);
            });

            return(JobCommands.Run(args, getServiceProvider, app => {
                app.Name = "Foundatio.JobCommands";
                app.FullName = "Foundation JobCommands Sample";
                app.ShortVersionGetter = () => "1.0.0";
            }, loggerFactory));
        }