示例#1
0
        public void Log(PerformanceLogTick t)
        {
            if (t.Stopwatch != null)
            {
                t.Stopwatch.Stop();

                _loggingService.Information(
                    Pattern,
                    _applicationConfiguration.GetCurrentEnvironment().ToString(),
                    _applicationConfiguration.GetApplicationId() ?? "",
                    _applicationConfiguration.GetInstanceId() ?? "",
                    t.Action ?? "",
                    t.Url ?? "",
                    t.HttpResponse ?? "",
                    t.HttpResponseStatusCode ?? "",
                    t.Browser ?? "",
                    t.RequestJson,
                    t.ResponseJson,
                    t.Stopwatch.ElapsedMilliseconds,
                    t.CorrelationId,
                    t.Exception
                    );
            }
            else
            {
                _loggingService.Information(
                    Pattern,
                    _applicationConfiguration.GetCurrentEnvironment().ToString(),
                    _applicationConfiguration.GetApplicationId() ?? "",
                    _applicationConfiguration.GetInstanceId() ?? "",
                    t.Action ?? "",
                    t.Url ?? "",
                    t.HttpResponse ?? "",
                    t.HttpResponseStatusCode ?? "",
                    t.Browser ?? "",
                    t.RequestJson,
                    t.ResponseJson,
                    t.Miliseconds,
                    t.CorrelationId,
                    t.Exception
                    );
            }
        }
        protected override void InnerExecute(string[] arguments)
        {
            if (arguments.Length == 0)
            {
                throw new CommandException("An application name must be provided to create an application");
            }

            var result = _appHarborClient.CreateApplication(arguments.First(), _region);

            _textWriter.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", result.Id);
            _textWriter.WriteLine("");

            try
            {
                _textWriter.WriteLine("This directory is already configured to track application \"{0}\".",
                                      _applicationConfiguration.GetApplicationId());
            }
            catch (ApplicationConfigurationException)
            {
                _applicationConfiguration.SetupApplication(result.Id, _appHarborClient.GetUser());
            }
        }