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

/* This is a virtual base class for all log targets.
   A log target has a constructor with the log target in string form,
   and a write() method to write log messages. that's it. */

namespace ns_log {

class LogTarget {
private:
    char _name[256];
    LogTarget();
    LogTarget& operator =(const LogTarget &);
    LogTarget(const LogTarget&);

public:
    LogTarget(const char *name);
    virtual int write(const char *buf, int bufLen) = 0;
    virtual ~LogTarget();
    static LogTarget *makeTarget(const char *target);
    static LogTarget *defaultTarget();
    virtual const char *name() const { return _name; }
    virtual bool makeHumanReadable() const { return false; }
};

} // end namespace ns_log