public void Setup()
        {
            //Create an example JSON log file to check results
            //As a one time setup for all tets in this class/fixture

            var exampleLogfilePath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Logging\", _logfileName);

            _newLogfileDirPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"App_Data\Logs\");
            _newLogfilePath    = Path.Combine(_newLogfileDirPath, _logfileName);

            var exampleSearchfilePath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Logging\", _searchfileName);

            _newSearchfileDirPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Config\");
            _newSearchfilePath    = Path.Combine(_newSearchfileDirPath, _searchfileName);

            //Create/ensure Directory exists
            IOHelper.EnsurePathExists(_newLogfileDirPath);
            IOHelper.EnsurePathExists(_newSearchfileDirPath);

            //Copy the sample files
            File.Copy(exampleLogfilePath, _newLogfilePath, true);
            File.Copy(exampleSearchfilePath, _newSearchfilePath, true);

            var logger = Mock.Of <Core.Logging.ILogger>();

            _logViewer = new JsonLogViewer(logger, logsPath: _newLogfileDirPath, searchPath: _newSearchfilePath);
        }
예제 #2
0
        public void Setup()
        {
            var testRoot = TestContext.CurrentContext.TestDirectory.Split("bin")[0];

            // Create an example JSON log file to check results
            // As a one time setup for all tets in this class/fixture
            IIOHelper           ioHelper   = TestHelper.IOHelper;
            IHostingEnvironment hostingEnv = TestHelper.GetHostingEnvironment();

            ILoggingConfiguration loggingConfiguration = TestHelper.GetLoggingConfiguration(hostingEnv);

            var exampleLogfilePath = Path.Combine(testRoot, "TestHelpers", "Assets", LogfileName);

            _newLogfileDirPath = loggingConfiguration.LogDirectory;
            _newLogfilePath    = Path.Combine(_newLogfileDirPath, LogfileName);

            // Create/ensure Directory exists
            ioHelper.EnsurePathExists(_newLogfileDirPath);

            // Copy the sample files
            File.Copy(exampleLogfilePath, _newLogfilePath, true);

            ILogger <SerilogJsonLogViewer> logger = Mock.Of <ILogger <SerilogJsonLogViewer> >();
            var logViewerConfig = new LogViewerConfig(LogViewerQueryRepository, Mock.Of <IScopeProvider>());
            var logLevelLoader  = Mock.Of <ILogLevelLoader>();

            _logViewer = new SerilogJsonLogViewer(logger, logViewerConfig, loggingConfiguration, logLevelLoader, Log.Logger);
        }
예제 #3
0
 public LogViewerController(ILogViewer logViewer)
 {
     _logViewer = logViewer ?? throw new ArgumentNullException(nameof(logViewer));
 }
 public LogViewerController(ILogViewer logViewer)
     : this(logViewer, StaticServiceProvider.Instance.GetRequiredService <ILogLevelLoader>())
 {
 }
예제 #5
0
 public LogsController(ILogViewer logViewer)
 {
     this.logViewer = logViewer;
 }
 public LogViewerController(ILogViewer logViewer)
 {
     _logViewer = logViewer;
 }
예제 #7
0
 /// <summary>
 /// Sets the log viewer.
 /// </summary>
 /// <param name="composition">A composition.</param>
 /// <param name="helper">A log viewer.</param>
 public static void SetLogViewer(this Composition composition, ILogViewer viewer)
 {
     composition.RegisterUnique(_ => viewer);
 }
예제 #8
0
 /// <summary>
 /// Sets the log viewer.
 /// </summary>
 /// <param name="builder">A builder.</param>
 /// <param name="viewer">A log viewer.</param>
 public static IUmbracoBuilder SetLogViewer(this IUmbracoBuilder builder, ILogViewer viewer)
 {
     builder.Services.AddUnique(viewer);
     return(builder);
 }
 public LogExporterController(ILogExportBuilder logExportBuilder, ILogger logger, ILogViewer logViewer)
 {
     _logExportBuilder = logExportBuilder ?? throw new ArgumentNullException(nameof(logExportBuilder));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     _logViewer        = logViewer ?? throw new ArgumentNullException(nameof(logViewer));
 }
예제 #10
0
 public ContactController(ILogViewer logViewer)
 {
     _logViewer = logViewer;
 }
        public void SetViews(IEnumerable<string> viewIdentifiers)
        {
            if (viewIdentifiers != null && viewIdentifiers.Count() >= 1)
            {
                string guid = viewIdentifiers.ElementAt(0);
                PrimaryView = viewManager.GetInstance(guid);
                PrimaryView.SetLogger(log);
                PrimaryTitle = viewManager.Get(guid).Name;
            }

            if (viewIdentifiers != null && viewIdentifiers.Count() >= 2)
            {
                string guid = viewIdentifiers.ElementAt(1);
                SecondaryView = viewManager.GetInstance(guid);
                SecondaryView.SetLogger(log);
                SecondaryTitle = viewManager.Get(guid).Name;
            }

            if (viewIdentifiers != null && viewIdentifiers.Count() == 1)
            {
                CollapseSecondaryView();
            }
        }