blob: ad8aa54f5464e452e59d810c1ea87649bc91d431 (
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 Vespa.ai. 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
|