HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
UT_UniversalLogSink.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: UT_UniversalLogSink.h ( FS Library, C++)
7
*
8
* COMMENTS:
9
*
10
*/
11
12
#ifndef __UT_UniversalLogSink__
13
#define __UT_UniversalLogSink__
14
15
#include "
UT_API.h
"
16
#include "
UT_Function.h
"
17
#include "
UT_Lock.h
"
18
#include "
UT_SharedPtr.h
"
19
#include "
UT_StringSet.h
"
20
#include "
UT_UniversalLogEntry.h
"
21
22
class
UT_StringArray
;
23
class
UT_StringHolder
;
24
class
UT_UniversalLogFileSink
;
25
class
UT_UniversalLogInMemorySink
;
26
27
/// This class exists to amalgamate logging information from a variety of
28
/// sources (UT_UniversalLogSource objects). Log entries can be fetched and
29
/// filtered to present the user with just the logging they are interested in.
30
class
UT_API
UT_UniversalLogSink
31
{
32
public
:
33
using
LogEntryFilterCallback
=
UT_Function
<bool(
34
const
UT_UniversalLogEntry
&)>;
35
36
UT_UniversalLogSink
();
37
virtual
~
UT_UniversalLogSink
();
38
39
/// Each sink creates its own source objects, and can only have one source
40
/// of any given type.
41
void
connect(
const
UT_StringHolder
&source_name);
42
void
disconnect(
const
UT_StringHolder
&source_name);
43
void
disconnectAll();
44
void
getConnectedSourceNames(
UT_StringArray
&source_names);
45
46
void
setFilterEntryCallback
(
const
LogEntryFilterCallback
&callback)
47
{ myLogEntryFilterCallback = callback; }
48
49
/// Record a message from a log source.
50
void
log
(
const
UT_UniversalLogEntry
&entry);
51
52
protected
:
53
virtual
void
doLog(
const
UT_UniversalLogEntry
&entry) = 0;
54
55
private
:
56
UT_StringSet
mySources;
57
UT_Lock
mySourcesLock;
58
LogEntryFilterCallback myLogEntryFilterCallback;
59
};
60
61
// Functions related to the default in memory and file logs.
62
UT_API
bool
63
UThasAnyDefaultLogInMemorySources
();
64
UT_API
bool
65
UThasAnyDefaultLogFileSources
();
66
UT_API
bool
67
UTisDefaultLogInMemorySource
(
const
UT_StringRef
&source_name);
68
UT_API
bool
69
UTisDefaultLogFileSource
(
const
UT_StringRef
&source_name);
70
UT_API
const
UT_SharedPtr<UT_UniversalLogInMemorySink>
&
71
UTgetDefaultLogInMemorySink
(
bool
create_from_env,
bool
force_create);
72
UT_API
const
UT_SharedPtr<UT_UniversalLogFileSink>
&
73
UTgetDefaultLogFileSink
(
bool
create);
74
75
#endif
76
UT_SharedPtr.h
UTisDefaultLogInMemorySource
UT_API bool UTisDefaultLogInMemorySource(const UT_StringRef &source_name)
UThasAnyDefaultLogInMemorySources
UT_API bool UThasAnyDefaultLogInMemorySources()
UT_API.h
UT_API
#define UT_API
Definition:
UT_API.h:14
UT_StringRef
Definition:
UT_StringHolder.h:188
UT_UniversalLogEntry.h
UTisDefaultLogFileSource
UT_API bool UTisDefaultLogFileSource(const UT_StringRef &source_name)
UT_SpinLockT< true, false >
UT_UniversalLogSink
Definition:
UT_UniversalLogSink.h:30
UT_UniversalLogSink::LogEntryFilterCallback
UT_Function< bool(const UT_UniversalLogEntry &)> LogEntryFilterCallback
Definition:
UT_UniversalLogSink.h:34
UT_StringHolder
Definition:
UT_StringHolder.h:999
UT_UniversalLogSink::setFilterEntryCallback
void setFilterEntryCallback(const LogEntryFilterCallback &callback)
Definition:
UT_UniversalLogSink.h:46
UT_StringArray
Definition:
UT_StringArray.h:24
UTgetDefaultLogInMemorySink
UT_API const UT_SharedPtr< UT_UniversalLogInMemorySink > & UTgetDefaultLogInMemorySink(bool create_from_env, bool force_create)
UT_StringSet
Definition:
UT_StringSet.h:45
UT_SharedPtr
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition:
UT_SharedPtr.h:36
UT_StringSet.h
UThasAnyDefaultLogFileSources
UT_API bool UThasAnyDefaultLogFileSources()
UT_Function.h
UT_UniversalLogFileSink
Definition:
UT_UniversalLogFileSink.h:22
UT_UniversalLogInMemorySink
Definition:
UT_UniversalLogInMemorySink.h:29
UT_Function
std::function< T > UT_Function
Definition:
UT_Function.h:37
UTgetDefaultLogFileSink
UT_API const UT_SharedPtr< UT_UniversalLogFileSink > & UTgetDefaultLogFileSink(bool create)
simd::log
OIIO_FORCEINLINE T log(const T &v)
Definition:
simd.h:7688
UT_Lock.h
UT_UniversalLogEntry
Simple object to hold the data associated with a single log entry event.
Definition:
UT_UniversalLogEntry.h:58
UT
UT_UniversalLogSink.h
Generated on Tue Dec 24 2024 02:43:03 for HDK by
1.8.6