コード例 #1
0
        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));
 }
コード例 #4
0
 public LogViewerController(ILogViewer logViewer)
     : this(logViewer, StaticServiceProvider.Instance.GetRequiredService <ILogLevelLoader>())
 {
 }
コード例 #5
0
ファイル: LogsController.cs プロジェクト: jcme/Sample-MVC
 public LogsController(ILogViewer logViewer)
 {
     this.logViewer = logViewer;
 }
コード例 #6
0
 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);
 }
コード例 #9
0
 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;
 }
コード例 #11
0
        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();
            }
        }