@@ -9,27 +9,31 @@ unsafe impl UriBound for EntryClass {
9
9
const URI : & ' static [ u8 ] = lv2_sys:: LV2_LOG__Entry ;
10
10
}
11
11
12
+ /// UriBound for an error message.
12
13
pub struct ErrorClass ;
13
14
unsafe impl UriBound for ErrorClass {
14
15
const URI : & ' static [ u8 ] = lv2_sys:: LV2_LOG__Error ;
15
16
}
16
17
18
+ /// UriBound for an informative message.
17
19
pub struct NoteClass ;
18
20
unsafe impl UriBound for NoteClass {
19
21
const URI : & ' static [ u8 ] = lv2_sys:: LV2_LOG__Note ;
20
22
}
21
23
24
+ /// UriBound for a debuging message.
22
25
pub struct TraceClass ;
23
26
unsafe impl UriBound for TraceClass {
24
27
const URI : & ' static [ u8 ] = lv2_sys:: LV2_LOG__Trace ;
25
28
}
26
29
30
+ /// Uribound for an error message.
27
31
pub struct WarningClass ;
28
32
unsafe impl UriBound for WarningClass {
29
33
const URI : & ' static [ u8 ] = lv2_sys:: LV2_LOG__Warning ;
30
34
}
31
35
32
- /// Marker for URID representing the nature of a log message
36
+ /// Marker for URID representing the nature of a log message.
33
37
// Note : it's may be better to have a URID trait to define a common interface
34
38
pub unsafe trait EntryType
35
39
where
@@ -59,7 +63,7 @@ unsafe impl EntryType for URID<WarningClass> {
59
63
}
60
64
}
61
65
62
- /// Errors potentially generated by [`Log`](struct.Log.html) methods
66
+ /// Errors potentially generated by [`Log`](struct.Log.html) methods.
63
67
#[ derive( PartialEq , Eq , Clone , Copy , Debug ) ]
64
68
pub enum LogError {
65
69
/// An error occured when sending message to the host
@@ -72,7 +76,7 @@ pub enum LogError {
72
76
NoCallback ,
73
77
}
74
78
75
- /// The Log feature
79
+ /// The Log feature.
76
80
#[ repr( transparent) ]
77
81
pub struct Log < ' a > {
78
82
internal : & ' a lv2_sys:: LV2_Log_Log ,
@@ -93,6 +97,17 @@ unsafe impl<'a> Feature for Log<'a> {
93
97
}
94
98
95
99
impl < ' a > Log < ' a > {
100
+ /// Send a log message to the host.
101
+ ///
102
+ /// the `entry_type` parameter is an URID representing the kind of log message. There are four
103
+ /// kind of message:
104
+ /// * **note:** an informative message.
105
+ /// * **warning:** a warning message.
106
+ /// * **error:** an error message.
107
+ /// * **trace:** a debugging trace. These entries should not be displayed during normal
108
+ /// operation, but the host may implement an option to display them for debugging purposes.
109
+ /// This entry type is special in that it may be written to in a real-time thread. It is
110
+ /// assumed that if debug tracing is enabled, real-time considerations are not a concern.
96
111
pub fn print ( & self , entry_type : impl EntryType , message : & str ) -> Result < ( ) , LogError > {
97
112
let printf = if let Some ( printf) = self . internal . printf {
98
113
printf
@@ -127,7 +142,7 @@ impl<'a> Log<'a> {
127
142
}
128
143
}
129
144
130
- /// A URID cache containing all time properties.
145
+ /// A URID cache containing all log properties.
131
146
#[ derive( URIDCollection , Debug ) ]
132
147
pub struct LogURIDCollection {
133
148
pub entry_class : URID < EntryClass > ,
0 commit comments