private void Init(TOptions options)
        {
            Application.AddDefines(options.Defines);

            var projName      = Assembly.GetEntryAssembly().GetName().Name.Replace(".", " - ");
            var componentName = GetComponentName(options);

            Console.Title = $"{projName}, {componentName}";

            string logsDirectory =
                Path.GetFullPath(options.Log.IsNotEmptyString() ? options.Log : GetLogsDirectory(options));

            EventStoreLoggerConfiguration.Initialize(logsDirectory, componentName);

            Log.Information("\n{description,-25} {version} ({branch}/{hashtag}, {timestamp})", "ES VERSION:",
                            VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp);
            Log.Information("{description,-25} {osFlavor} ({osVersion})", "OS:", OS.OsFlavor, Environment.OSVersion);
            Log.Information("{description,-25} {osRuntimeVersion} ({architecture}-bit)", "RUNTIME:",
                            OS.GetRuntimeVersion(),
                            Marshal.SizeOf(typeof(IntPtr)) * 8);
            Log.Information("{description,-25} {maxGeneration}", "GC:",
                            GC.MaxGeneration == 0
                                        ? "NON-GENERATION (PROBABLY BOEHM)"
                                        : $"{GC.MaxGeneration + 1} GENERATIONS");
            Log.Information("{description,-25} {logsDirectory}", "LOGS:", logsDirectory);

            Log.Information(EventStoreOptions.DumpOptions());

            if (options.WhatIf)
            {
                Application.Exit(ExitCode.Success, "WhatIf option specified");
            }
        }
示例#2
0
        private void Init(TOptions options)
        {
            Application.AddDefines(options.Defines);

            var projName      = Assembly.GetEntryAssembly().GetName().Name.Replace(".", " - ");
            var componentName = GetComponentName(options);

            Console.Title = string.Format("{0}, {1}", projName, componentName);

            string logsDirectory = Path.GetFullPath(options.Log.IsNotEmptyString() ? options.Log : GetLogsDirectory(options));

            LogManager.Init(componentName, logsDirectory, Locations.DefaultConfigurationDirectory);

            Log.Info("\n{0,-25} {1} ({2}/{3}, {4})\n"
                     + "{5,-25} {6} ({7})\n"
                     + "{8,-25} {9} ({10}-bit)\n"
                     + "{11,-25} {12}\n"
                     + "{13,-25} {14}\n\n"
                     + "{15}",
                     "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp,
                     "OS:", OS.OsFlavor, Environment.OSVersion,
                     "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8,
                     "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1),
                     "LOGS:", LogManager.LogsDirectory,
                     EventStoreOptions.DumpOptions());

            if (options.WhatIf)
            {
                Application.Exit(ExitCode.Success, "WhatIf option specified");
            }
        }
示例#3
0
        private void Init(TOptions options)
        {
            Application.AddDefines(options.Defines);

            var projName      = Assembly.GetEntryAssembly().GetName().Name.Replace(".", " - ");
            var componentName = GetComponentName(options);

            Console.Title = string.Format("{0}, {1}", projName, componentName);

            string logsDirectory = Path.GetFullPath(options.Log.IsNotEmptyString() ? options.Log : GetLogsDirectory(options));
            bool   structuredLog = GetIsStructuredLog(options);

            LogManager.Init(componentName, logsDirectory, structuredLog, Locations.DefaultConfigurationDirectory);

            Log.Info("\n{description,-25} {version} ({branch}/{hashtag}, {timestamp})", "ES VERSION:", VersionInfo.Version, VersionInfo.Branch, VersionInfo.Hashtag, VersionInfo.Timestamp);
            Log.Info("{description,-25} {osFlavor} ({osVersion})", "OS:", OS.OsFlavor, Environment.OSVersion);
            Log.Info("{description,-25} {osRuntimeVersion} ({architecture}-bit)", "RUNTIME:", OS.GetRuntimeVersion(), Marshal.SizeOf(typeof(IntPtr)) * 8);
            Log.Info("{description,-25} {maxGeneration}", "GC:", GC.MaxGeneration == 0 ? "NON-GENERATION (PROBABLY BOEHM)" : string.Format("{0} GENERATIONS", GC.MaxGeneration + 1));
            Log.Info("{description,-25} {logsDirectory}", "LOGS:", LogManager.LogsDirectory);
            if (!structuredLog)
            {
                Log.Info("{esOptions}", EventStoreOptions.DumpOptions());
            }
            else
            {
                Log.Info("{@esOptions}", EventStoreOptions.DumpOptionsStructured());
            }

            if (options.WhatIf)
            {
                Application.Exit(ExitCode.Success, "WhatIf option specified");
            }
        }
示例#4
0
        public void should_not_contain_the_unknown_option_in_the_dumping_of_the_options_environment_variable()
        {
            Environment.SetEnvironmentVariable(String.Format("{0}UNKNOWN_OPTION", Opts.EnvPrefix), "true");
            var args = new string[] { };

            EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix);

            Assert.False(EventStoreOptions.DumpOptions().Contains(String.Format("{0}UNKNOWN_OPTION", Opts.EnvPrefix)));
        }