예제 #1
0
        private static void SendLogFilePathToExchange(ILoggerSync logger, IRollingFileLogSink fileLogSink, AppOptions options)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(options.ExchangePath))
                {
                    logger.PostEntry("Exchange -e option not set, skipping.");
                    return;
                }

                logger.PostEntry("Attempting connection to UI Host '" + SharedConst.LogExchangeNetPipe + "'.");

                var endPoint    = new EndpointAddress(SharedConst.LogExchangeNetPipe);
                var pipeFactory = new ChannelFactory <ILogExchange>(new NetNamedPipeBinding(), endPoint);
                var logExchange = pipeFactory.CreateChannel();

                logExchange.ReportLogFilePath(fileLogSink.CurrentLogFilePath ?? "Path not found.");
            }
            catch (EndpointNotFoundException ex)
            {
                logger.PostException(ex);
            }
        }
예제 #2
0
        private static void SendLogFilePathToExchange(ILoggerSync logger, IRollingFileLogSink fileLogSink, AppOptions options)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(options.ExchangePath))
                {
                    logger.PostEntry("Exchange -e option not set, skipping.");
                    return;
                }

                logger.PostEntry("Attempting connection to UI Host '" + SharedConst.LogExchangeNetPipe + "'.");

                var endPoint = new EndpointAddress(SharedConst.LogExchangeNetPipe);
                var pipeFactory = new ChannelFactory<ILogExchange>(new NetNamedPipeBinding(), endPoint);
                var logExchange = pipeFactory.CreateChannel();

                logExchange.ReportLogFilePath(fileLogSink.CurrentLogFilePath ?? "Path not found.");
            }
            catch(EndpointNotFoundException ex)
            {
                logger.PostException(ex);
            }
        }