Exemple #1
0
        public static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console(outputTemplate:
                                          "{Timestamp:HH:mm:ss} {Level:u3} [{SourceContext}] {Properties} {Message:lj}{NewLine}{Exception}")
                         .MinimumLevel.Verbose()
                         .Enrich.FromLogContext()
                         .CreateLogger();

            var app = new CommandLineApplication
            {
                Name     = "modsink",
                FullName = "ModSink.CLI"
            };

            app.HelpOption("-?|-h|--help");
            app.ShortVersionGetter = () => typeof(Program).Assembly.GetName().Version.ToString();

            app.AddColCheck();
            app.AddSampleRepo();
            app.AddDownload();
            app.AddImport();
            app.AddDump();
            app.AddCheck();

            app.Execute(args.Length > 0 ? args : new[] { "--help" });
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console(
                theme: AnsiConsoleTheme.Code,
                outputTemplate:
                "{Timestamp:HH:mm:ss} {Level:u3} {SourceContext} {Message:lj} {Properties} {NewLine}{Exception}")
                         .WriteTo.File(new CompactJsonFormatter(), "log.txt", fileSizeLimitBytes: 10 * 1024 * 1024,
                                       buffered: true, flushToDiskInterval: 10.Seconds(), rollingInterval: RollingInterval.Day,
                                       rollOnFileSizeLimit: true)
                         .MinimumLevel.Verbose()
                         .Enrich.FromLogContext()
                         .Enrich.WithDemystifiedStackTraces()
                         .Enrich.WithMemoryUsage()
                         .Enrich.WithThreadId()
                         .CreateLogger();

            var app = new CommandLineApplication
            {
                Name     = "modsink",
                FullName = "ModSink.CLI"
            };

            app.HelpOption("-?|-h|--help");
            app.ShortVersionGetter = () => typeof(Program).Assembly.GetName().Version.ToString();

            app.AddColCheck();
            app.AddSampleRepo();
            app.AddImport();
            app.AddDump();
            app.AddCheck();

            app.Execute(args.Length > 0 ? args : new[] { "--help" });
        }