blob: 0856fff58f2141cc3078a57350bba1ecaafee1f0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vector>
namespace logdemon {
class Forwarder;
class ConfigSubscriber;
/**
* Class used to watch a log file and forward new log lines to the logserver.
*/
class Watcher
{
private:
std::vector<char> _buffer;
ConfigSubscriber & _confsubscriber;
Forwarder & _forwarder;
int _wfd;
char * getBuf() { return &_buffer[0]; }
long getBufSize() const { return _buffer.size(); }
public:
Watcher(const Watcher& other) = delete;
Watcher& operator=(const Watcher& other) = delete;
Watcher(ConfigSubscriber &cfs, Forwarder &fw);
~Watcher();
void watchfile();
void removeOldLogs(const char *prefix);
};
}
|