Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
 public GeneratorParameters()
 {
     Count               = 0;  // Infinity messages
     Rate                = 10; // Milliseconds
     Message             = "Hello, world!";
     CodecArguments      = new CodecArguments();
     CodecArguments.Type = CodecArguments.CodecType.plain;
 }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 public PlainCodec(CodecArguments args)
 {
     _codecArguments = args;
 }
Exemplo n.º 6
0
 // return true to cancel codec
 public Multiline(CodecArguments args)
 {
     _codecArguments = args;
 }
Exemplo n.º 7
0
 public JsonCodec(CodecArguments args)
 {
     _codecArguments = args;
 }
Exemplo n.º 8
0
 public GeneratorParameters()
 {
     Count = 0; // Infinity messages
     Rate = 10; // Milliseconds
     Message = "Hello, world!";
     CodecArguments = new CodecArguments();
     CodecArguments.Type = CodecArguments.CodecType.plain;
 }