コード例 #1
0
ファイル: DatabaseLogger.cs プロジェクト: yao-yi/DNTProfiler
        public void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs,
                           DbConfigurationInterceptionContext interceptionContext)
        {
            var logger = new ExceptionLogger();

            _baseInfoQueue = new InfoQueue <BaseInfo>();
            var profiler = new DbProfiler(_baseInfoQueue)
            {
                AssembliesToExclude = new SortedSet <string>
                {
                    typeof(DbProfiler).Assembly.GetName().Name,
                    typeof(DatabaseLogger).Assembly.GetName().Name
                }
            };

            DbInterception.Add(new DatabaseInterceptor(profiler));
            _commandsTransmitter = new CommandsTransmitter(
                _baseInfoQueue, logger, new SimpleHttp(), _serverUri, LoggerPath.GetLogFileFullPath(_logFilePath));
            _commandsTransmitter.Start();
        }
コード例 #2
0
ファイル: DatabaseLogger.cs プロジェクト: yao-yi/DNTProfiler
        private DatabaseLogger()
        {
            AppDomain.MonitoringIsEnabled = true;
            var logger        = new ExceptionLogger();
            var baseInfoQueue = new InfoQueue <BaseInfo>();

            Profiler = new DbProfiler(baseInfoQueue)
            {
                AssembliesToExclude = new SortedSet <string>
                {
                    typeof(DbProfiler).Assembly.GetName().Name,
                    typeof(DatabaseLogger).Assembly.GetName().Name
                }
            };
            var serverUri           = new Uri(ConfigSetGet.GetConfigData("DNTProfilerServerUri"));
            var logFilePath         = ConfigSetGet.GetConfigData("DNTProfilerLogFilePath");
            var commandsTransmitter = new CommandsTransmitter(
                baseInfoQueue, logger, new SimpleHttp(), serverUri, LoggerPath.GetLogFileFullPath(logFilePath));

            commandsTransmitter.Start();
        }