-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathlog.h
93 lines (77 loc) · 3.13 KB
/
log.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
///////////////////////////////////////////////////////////////////////////////
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is MP4v2.
//
// The Initial Developer of the Original Code is David Byron.
// Portions created by David Byron are Copyright (C) 2009, 2010, 2011.
// All Rights Reserved.
//
// Contributors:
// David Byron, [email protected]
//
///////////////////////////////////////////////////////////////////////////////
#ifndef MP4V2_IMPL_LOG_H
#define MP4V2_IMPL_LOG_H
namespace mp4v2 { namespace impl {
///////////////////////////////////////////////////////////////////////////////
/**
* Handle logging either to standard out or to a callback
* function
*/
class MP4V2_EXPORT Log {
private:
MP4LogLevel _verbosity;
static MP4LogCallback _cb_func;
public:
const MP4LogLevel& verbosity;
public:
Log( MP4LogLevel = MP4_LOG_NONE );
virtual ~Log();
static void setLogCallback ( MP4LogCallback );
void setVerbosity ( MP4LogLevel );
void errorf ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void warningf ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void infof ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void verbose1f ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void verbose2f ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void verbose3f ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void verbose4f ( const char* format, ... ) MP4V2_WFORMAT_PRINTF(2,3);
void dump ( uint8_t indent,
MP4LogLevel verbosity_,
const char* format, ... ) MP4V2_WFORMAT_PRINTF(4,5);
void vdump ( uint8_t indent,
MP4LogLevel verbosity_,
const char* format, va_list ap );
void printf ( MP4LogLevel verbosity_,
const char* format, ... ) MP4V2_WFORMAT_PRINTF(3,4);
void vprintf ( MP4LogLevel verbosity_,
const char* format, va_list ap );
void hexDump ( uint8_t indent,
MP4LogLevel verbosity_,
const uint8_t* pBytes,
uint32_t numBytes,
const char* format, ... ) MP4V2_WFORMAT_PRINTF(6,7);
void errorf ( const Exception& x );
private:
Log ( const Log &src );
Log &operator= ( const Log &src );
};
/**
* A global (at least to mp4v2) log object for code that
* needs to log something but doesn't otherwise have access
* to one
*/
extern Log log;
///////////////////////////////////////////////////////////////////////////////
}} // namespace mp4v2::impl
#endif // MP4V2_IMPL_LOG_H