public LogsListener(TimberWinR.Parser.LogParameters arguments, CancellationToken cancelToken)
            : base(cancelToken, "Win32-FileLog")
        {
            Stop = false;

            EnsureRollingCaught();

             _codecArguments = arguments.CodecArguments;

            _codecArguments = arguments.CodecArguments;
            if (_codecArguments != null && _codecArguments.Type == CodecArguments.CodecType.multiline)
                _codec = new Multiline(_codecArguments);

            if (!string.IsNullOrEmpty(arguments.Type))
                SetTypeName(arguments.Type);

            _receivedMessages = 0;
            _arguments = arguments;
            _pollingIntervalInSeconds = arguments.Interval;

            IsWildcardFilePattern = arguments.Location.Contains('*');

            foreach (string srcFile in _arguments.Location.Split(','))
            {
                string file = srcFile.Trim();
                string dir = Path.GetDirectoryName(file);
                if (string.IsNullOrEmpty(dir))
                    dir = Environment.CurrentDirectory;
                string fileSpec = Path.Combine(dir, file);

                Task.Factory.StartNew(() => FileWatcher(fileSpec));
            }
        }
        public TailFileListener(TimberWinR.Parser.TailFileArguments arguments,
            CancellationToken cancelToken)
            : base(cancelToken, "Win32-TailLog")
        {
            Stop = false;

            EnsureRollingCaught();

            _codecArguments = arguments.CodecArguments;
            if (_codecArguments != null && _codecArguments.Type == CodecArguments.CodecType.multiline)
                _codec = new Multiline(_codecArguments);

            if (!string.IsNullOrEmpty(arguments.Type))
                SetTypeName(arguments.Type);

            _receivedMessages = 0;
            _arguments = arguments;
            _pollingIntervalInSeconds = arguments.Interval;

            foreach (string srcFile in _arguments.Location.Split(','))
            {
                string file = srcFile.Trim();
                Task.Factory.StartNew(() => TailFileWatcher(file));
            }
        }
Beispiel #3
0
 public GeneratorParameters()
 {
     Count               = 0;  // Infinity messages
     Rate                = 10; // Milliseconds
     Message             = "Hello, world!";
     CodecArguments      = new CodecArguments();
     CodecArguments.Type = CodecArguments.CodecType.plain;
 }
        public StdinListener(TimberWinR.Parser.Stdin arguments, CancellationToken cancelToken)
            : base(cancelToken, "Win32-Console")
        {
            _codecArguments = arguments.CodecArguments;
            if (_codecArguments != null && _codecArguments.Type == CodecArguments.CodecType.multiline)
                _codec = new Multiline(_codecArguments);

            _listenThread = new Thread(new ThreadStart(ListenToStdin));
            _listenThread.Start();
        }
 public PlainCodec(CodecArguments args)
 {
     _codecArguments = args;
 }
Beispiel #6
0
 // return true to cancel codec
 public Multiline(CodecArguments args)
 {
     _codecArguments = args;
 }
Beispiel #7
0
 public JsonCodec(CodecArguments args)
 {
     _codecArguments = args;
 }
Beispiel #8
0
 public GeneratorParameters()
 {
     Count = 0; // Infinity messages
     Rate = 10; // Milliseconds
     Message = "Hello, world!";
     CodecArguments = new CodecArguments();
     CodecArguments.Type = CodecArguments.CodecType.plain;
 }