Field3D
Log.h
Go to the documentation of this file.
1
//----------------------------------------------------------------------------//
2
3
/*
4
* Copyright (c) 2009 Sony Pictures Imageworks Inc
5
*
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
*
12
* Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in the
16
* documentation and/or other materials provided with the
17
* distribution. Neither the name of Sony Pictures Imageworks nor the
18
* names of its contributors may be used to endorse or promote
19
* products derived from this software without specific prior written
20
* permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33
* OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
//----------------------------------------------------------------------------//
37
43
//----------------------------------------------------------------------------//
44
45
#ifndef _INCLUDED_Field3D_Log_H_
46
#define _INCLUDED_Field3D_Log_H_
47
48
//----------------------------------------------------------------------------//
49
50
#include <boost/lexical_cast.hpp>
51
52
//----------------------------------------------------------------------------//
53
54
#include "
ns.h
"
55
56
FIELD3D_NAMESPACE_OPEN
57
58
//----------------------------------------------------------------------------//
59
// Msg namespace
60
//----------------------------------------------------------------------------//
61
63
namespace
Msg
{
64
66
enum
Severity
{
67
SevMessage
,
68
SevWarning
69
};
70
73
FIELD3D_API
void
print
(
Severity
severity,
const
std::string &message);
74
76
inline
void
print
(
const
std::string &message)
77
{
print
(
SevMessage
, message); }
78
81
FIELD3D_API
void
setVerbosity
(
int
level=1);
82
83
}
// namespace Msg
84
85
//----------------------------------------------------------------------------//
86
// Logging helper functions
87
//----------------------------------------------------------------------------//
88
90
std::string
bytesToString
(int64_t bytes);
91
92
//----------------------------------------------------------------------------//
93
96
size_t
currentRSS
();
97
98
//----------------------------------------------------------------------------//
99
100
FIELD3D_NAMESPACE_HEADER_CLOSE
101
102
//----------------------------------------------------------------------------//
103
104
#endif // Include guard
FIELD3D_NAMESPACE_HEADER_CLOSE
#define FIELD3D_NAMESPACE_HEADER_CLOSE
Definition:
ns.h:58
Msg::SevMessage
@ SevMessage
Definition:
Log.h:67
Msg::SevWarning
@ SevWarning
Definition:
Log.h:68
Msg
Contains logging-related functions.
Definition:
Log.h:63
Msg::Severity
Severity
Used by the Msg::print() call.
Definition:
Log.h:66
Msg::setVerbosity
FIELD3D_API void setVerbosity(int level=1)
Set the verbosity level of console output: 0 = do not echo anything to the console; >=1 = echo all me...
Definition:
Log.cpp:90
ns.h
currentRSS
size_t currentRSS()
Returns the current resident memory size.
Definition:
Log.cpp:136
FIELD3D_API
#define FIELD3D_API
Definition:
ns.h:77
FIELD3D_NAMESPACE_OPEN
Definition:
FieldMapping.cpp:74
Msg::print
FIELD3D_API void print(Severity severity, const std::string &message)
Sends the string to the assigned output, prefixing the message with the severity.
Definition:
Log.cpp:70
bytesToString
std::string bytesToString(int64_t bytes)
Converts a byte count into a human-readable string.
Definition:
Log.cpp:101
export
Log.h
Generated by
1.8.18