diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-03-20 14:42:44 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-03-20 14:42:44 +0000 |
commit | 1d7468ea7e13569f8d35127b952004cb628d4c4a (patch) | |
tree | 8148f7b7741c508a1bd5113c17431d17c13fe453 /logd/src/logd/watcher.h | |
parent | 934c2298df1e9bdbf8aa80bdcd0c8f671768baef (diff) |
Rename watch.{h,cpp} -> watcher.{h,cpp}.
Diffstat (limited to 'logd/src/logd/watcher.h')
-rw-r--r-- | logd/src/logd/watcher.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/logd/src/logd/watcher.h b/logd/src/logd/watcher.h new file mode 100644 index 00000000000..2629da040f7 --- /dev/null +++ b/logd/src/logd/watcher.h @@ -0,0 +1,33 @@ +// Copyright 2017 Yahoo Holdings. 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); +}; + +} |