예제 #1
0
 /// <summary>
 /// Create a new instance of LogReceiverLoggerFactory.
 /// </summary>
 /// <param name="aLoggerType">The Type of Logger this instance should eventually create.</param>
 /// <param name="portNumber">The port number on which to listen for new connections.</param>
 /// <param name="aTagInfo">Any information newly created Loggers should be passed.</param>
 public LogReceiverLoggerFactory(Type aLoggerType, int portNumber, Object aTagInfo)
 {
     CheckLoggerType(aLoggerType);
     loggerType = aLoggerType;
     tagInfo    = aTagInfo;
     listener   = LogSocketReader.StartListening(portNumber, this);
 }
예제 #2
0
        /// <summary>
        /// Create and initialize a new Logger.
        /// </summary>
        /// <param name="aLogSocketReader">The LogSocketReader.</param>
        /// <returns>The newly created Logger</returns>
        private Logger CreateNewLogger(LogSocketReader aLogSocketReader)
        {
            /*
             * Instead of calling the follwing constructor,
             * make it easier on developers who subclass LogReceiverLogger
             * by setting properties after creation instead.
             * return (Logger) loggerType.GetConstructor( new Type[2] { typeof(LogSocketReader), typeof(Object) } ).Invoke( new Object[2] { aLogSocketReader, tagInfo } );
             */
            LogReceiverLogger aLogger = (LogReceiverLogger)loggerType.GetConstructor(new Type[0]).Invoke(new Object[0]);

            aLogger.LogSocketReader = aLogSocketReader;
            aLogger.TagValue        = tagInfo;
            aLogger.PreStart(this);
            return(aLogger);
        }
예제 #3
0
 /// <summary>
 /// Create a new instance of LogReceiverLogger.
 /// </summary>
 /// <param name="aLogSocketReader">The LogSocketReader.</param>
 /// <param name="aTagValue">The TagValue.</param>
 public LogReceiverLogger(LogSocketReader aLogSocketReader, Object aTagValue)
 {
     LogSocketReader = aLogSocketReader;
     TagValue        = aTagValue;
 }
예제 #4
0
 /// <summary>
 /// This is a notification that a socket connection has been made
 /// and that a LogSocketReader is ready for reading.
 /// </summary>
 /// <param name="aLogSocketReader">The LogSocketReader that will read from the socket.</param>
 /// <returns>Always returns true, signifying that it is okay to accept more client connections.</returns>
 public bool ReaderReady(LogSocketReader aLogSocketReader)
 {
     aLogSocketReader.Logger = CreateNewLogger(aLogSocketReader);
     aLogSocketReader.Start();
     return(true);
 }