Beispiel #1
0
 public void Disable_Calls_Disable_Loggers(
     [Frozen] IRemoteLogger logger,
     RemoteLogger sut)
 {
     sut.Disable();
     Mock.Get(logger).Verify(c => c.Disable());
 }
Beispiel #2
0
        /// <summary>
        /// Setup the logger and update configuration if necessary
        /// </summary>
        private void SetupLogger()
        {
            // get the current endpoint uri
            var endpointUri = new Uri(_endpoint);
            var newLogger   = false;

            // check if logger is null
            if (_remoteLogger == null)
            {
                newLogger = true;
            }
            else
            {
                // get loaded logger config
                var loadedConfig = _remoteLogger.GetConfiguration();

                // check if the connection is different
                if (loadedConfig.Connection != _endpoint)
                {
                    newLogger = true;
                }
            }

            // create a new logger if we need to
            if (newLogger)
            {
                _remoteLogger = new RemoteLogger(new RemoteLoggerConfiguration(endpointUri));
            }
        }
 public void TrackError_Calls_External_Loggers(
     [Frozen] IRemoteLogger logger,
     RemoteLogger sut,
     Exception exception)
 {
     sut.TrackError(exception);
     Mock.Get(logger).Verify(c => c.TrackError(exception));
 }
 public void TrackFeatureUsage_Calls_External_Loggers(
     [Frozen] IRemoteLogger logger,
     RemoteLogger sut,
     string featureName,
     string[] tags)
 {
     sut.TrackFeatureUsage(featureName, tags);
     Mock.Get(logger).Verify(c => c.TrackFeatureUsage(featureName, tags));
 }
 public void Constructor_Adds_External_Loggers(
     [Frozen] IRemoteLogger logger,
     RemoteLogger sut)
 {
     sut
     .Loggers
     .Should()
     .Contain(logger);
 }
Beispiel #6
0
 public CodeGeneratorFactory(
     IOptionsFactory optionsFactory          = null,
     IProcessLauncher processLauncher        = null,
     IOpenApiDocumentFactory documentFactory = null,
     IRemoteLogger remoteLogger = null)
 {
     this.optionsFactory  = optionsFactory ?? new OptionsFactory();
     this.processLauncher = processLauncher ?? new ProcessLauncher();
     this.documentFactory = documentFactory ?? new OpenApiDocumentFactory();
     this.remoteLogger    = remoteLogger ?? Logger.Instance;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonEventLogger"/> class.
        /// </summary>
        /// <param name="applicationSettingsService">The application settings service.</param>
        /// <param name="remoteLogger">The remote logger.</param>
        public JsonEventLogger(
            IApplicationSettingsService applicationSettingsService,
            IRemoteLogger remoteLogger)
        {
            this.applicationSettingsService = applicationSettingsService;
            this.remoteLogger = remoteLogger;

            this.jsonSerializer = new DataContractJsonSerializer(
                typeof(List<EventRecord>),
                additionalKnownTypes);
        }
 public CodeGeneratorFactory(
     IOptionsFactory optionsFactory          = null,
     IProcessLauncher processLauncher        = null,
     IOpenApiDocumentFactory documentFactory = null,
     IRemoteLogger remoteLogger = null,
     IDependencyInstaller dependencyInstaller = null)
 {
     this.remoteLogger        = remoteLogger ?? Logger.Instance;
     this.optionsFactory      = optionsFactory ?? new OptionsFactory();
     this.processLauncher     = processLauncher ?? new ProcessLauncher();
     this.documentFactory     = documentFactory ?? new OpenApiDocumentFactory();
     this.dependencyInstaller = dependencyInstaller ??
                                new DependencyInstaller(
         new NpmInstaller(this.processLauncher),
         new FileDownloader(new WebDownloader()));
 }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MultiLogger"/> class.
        /// </summary>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="remoteRemoteLogger">
        /// The remote logger.
        /// </param>
        public MultiLogger(ILogger logger, IRemoteLogger remoteRemoteLogger)
            : base()
        {
            Mandate.ParameterNotNull(logger, "logger");
            _umbracoLogger = logger;

            if (remoteRemoteLogger != null)
            {
                this._remoteLogger = remoteRemoteLogger;
                _hasRemoteLogger = true;
            }
            else
            {
                _hasRemoteLogger = false;
            }
        }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MultiLogger"/> class.
        /// </summary>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="remoteRemoteLogger">
        /// The remote logger.
        /// </param>
        public MultiLogger(ILogger logger, IRemoteLogger remoteRemoteLogger)
            : base()
        {
            Mandate.ParameterNotNull(logger, "logger");
            _umbracoLogger = logger;

            if (remoteRemoteLogger != null)
            {
                this._remoteLogger = remoteRemoteLogger;
                _hasRemoteLogger   = true;
            }
            else
            {
                _hasRemoteLogger = false;
            }
        }
Beispiel #11
0
 public ClientApp(IConfigProvider configProvider, IRemoteLogger logger)
 {
     ConfigProvider = configProvider;
     Logger         = logger;
 }