29.1.1
by Jesse Barker
Add logging object for use by other projects. |
1 |
//
|
31
by Jesse Barker
Update copyrights for 2012 work. |
2 |
// Copyright (c) 2010-2012 Linaro Limited
|
29.1.1
by Jesse Barker
Add logging object for use by other projects. |
3 |
//
|
4 |
// All rights reserved. This program and the accompanying materials
|
|
5 |
// are made available under the terms of the MIT License which accompanies
|
|
6 |
// this distribution, and is available at
|
|
7 |
// http://www.opensource.org/licenses/mit-license.php
|
|
8 |
//
|
|
9 |
// Contributors:
|
|
10 |
// Alexandros Frantzis <alexandros.frantzis@linaro.org>
|
|
11 |
// Jesse Barker <jesse.barker@linaro.org>
|
|
12 |
//
|
|
13 |
#ifndef LOG_H_
|
|
14 |
#define LOG_H_
|
|
15 |
||
33
by Jesse Barker
Make sure to include string for the definiton of Log. |
16 |
#include <string> |
17 |
||
29.1.1
by Jesse Barker
Add logging object for use by other projects. |
18 |
class Log |
19 |
{
|
|
20 |
public: |
|
35
by Jesse Barker
Make appname a required parameter to Log::init and make it private as nothing public needs direct access |
21 |
static void init(const std::string& appname, bool do_debug = false) |
22 |
{
|
|
23 |
appname_ = appname; |
|
24 |
do_debug_ = do_debug; |
|
25 |
}
|
|
29.1.1
by Jesse Barker
Add logging object for use by other projects. |
26 |
// Emit an informational message
|
27 |
static void info(const char *fmt, ...); |
|
28 |
// Emit a debugging message
|
|
29 |
static void debug(const char *fmt, ...); |
|
30 |
// Emit an error message
|
|
31 |
static void error(const char *fmt, ...); |
|
32 |
// Explicit flush of the log buffer
|
|
33 |
static void flush(); |
|
34 |
// A prefix constant that informs the logging infrastructure that the log
|
|
35 |
// message is a continuation of a previous log message to be put on the
|
|
36 |
// same line.
|
|
37 |
static const std::string continuation_prefix; |
|
35
by Jesse Barker
Make appname a required parameter to Log::init and make it private as nothing public needs direct access |
38 |
private: |
29.1.1
by Jesse Barker
Add logging object for use by other projects. |
39 |
// A constant for identifying the log messages as originating from a
|
40 |
// particular application.
|
|
35
by Jesse Barker
Make appname a required parameter to Log::init and make it private as nothing public needs direct access |
41 |
static std::string appname_; |
42 |
// Indicates whether debug level messages should generate any output
|
|
29.1.1
by Jesse Barker
Add logging object for use by other projects. |
43 |
static bool do_debug_; |
44 |
};
|
|
45 |
||
46 |
#endif /* LOG_H_ */ |