예제 #1
0
 public async Task Test2()
 {
     CollectionManager   cm       = new CollectionManager(urlprd);
     ICollectionExporter exporter = new CollectionExporter(cm, null);
     await exporter.Export(new DiagnosticLogCenter.DbExportCore.Settings.ExportSetting()
     {
         ClientNames  = null,
         MaxDate      = DateTime.Today.AddMonths(-3),
         DropAfterBak = true
     });
 }
예제 #2
0
        /// <summary>
        /// xLiAd.DiagnosticLogCenter.DbExportConsole.exe --clients acc --url "mongodb://*****:*****@172.16.101.28:27017/LogCenterTest?authSource=admin&authMechanism=SCRAM-SHA-1" --dropafterbak 0 --maxdate 150d
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static async Task Main(string[] args)
        {
            Arguments arg = ArgumentsHelper.BindArguments <Arguments>(args);

            if (arg.Url.NullOrEmpty())
            {
                Console.WriteLine("Url 参数不能为空!");
                return;
            }
            CollectionManager   cm       = new CollectionManager(arg.Url);
            ICollectionExporter exporter = new CollectionExporter(cm, new TextLog());
            await exporter.Export(new DiagnosticLogCenter.DbExportCore.Settings.ExportSetting()
            {
                ClientNames  = (arg.Clients.NullOrEmpty() || arg.Clients == "*") ? null : arg.Clients.Split(','),
                MaxDate      = ProcessDate(arg.MaxDate),
                DropAfterBak = arg.DropAfterBak != null &&
                               (arg.DropAfterBak.Equals("true", StringComparison.OrdinalIgnoreCase) || arg.DropAfterBak == "1")
            });
        }