aboutsummaryrefslogtreecommitdiffstats
path: root/vespalog/src/vespa/log/log-target-fd.h
blob: e0504d363d30a9848a4c3fae16cfdacd82a871cc (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "log-target.h"

namespace ns_log {

class LogTargetFd : public LogTarget {
private:
    int _fd;
    bool _istty;
    LogTargetFd() = delete;
    LogTargetFd(const LogTargetFd&) = delete;
    LogTargetFd& operator= (const LogTargetFd) = delete;

public:
    LogTargetFd(int fd_spec, const char *target);
    int write(const char *buf, int len) override;
    ~LogTargetFd();
    bool makeHumanReadable() const override { return _istty; }
};


} // end namespace log