Expand description
A strongly typed Event Tracing for Windows wrapper.
The gen_etw_wrapper! macro turns an ETW manifest into a strongly typed provider struct.
This crate supports Windows only.
use etw_wrapper::{Result, gen_etw_wrapper};
gen_etw_wrapper!("manifests/widgetservice.man", PROVIDER_WIDGETSERVICE -> WidgetLogger);
fn main() -> Result<()> {
let provider = WidgetLogger::register()?;
provider.request_failed(0x12ABCDEF, 500, 42, "failed to succeed")?;
Ok(())
}To avoid the procedural macro, call EtwLogger::register, optionally check
EtwLogger::enabled before EtwLogger::write, and convert parameters to
EventDataDescriptor instances with the helpers in the
field module.
use etw_wrapper::{EtwLogger, EventDescriptor, Guid, field::*};
let ctx = EtwLogger::register(&Guid::default()).unwrap();
let x = 1u32;
let y = to_u16cstring("hello");
let descriptor = EventDescriptor::default();
ctx.write(&descriptor, &[scalar(&x), str16(&y).unwrap()]).unwrap();Modules§
- field
- Serialization primitives that turn typed values into
EventDataDescriptorinstances.
Macros§
- gen_
etw_ wrapper macro - Generates strongly typed ETW providers from an instrumentation manifest.
Structs§
- EtwLogger
- A registered ETW provider.
- Event
Descriptor - Describes an ETW event’s identity and filtering metadata. Describes an ETW event’s identity and filtering metadata.
- File
Time - A Windows file time represented as 100-nanosecond intervals since January 1, 1601 UTC. A Windows file time represented as 100-nanosecond intervals since January 1, 1601 UTC.
- Guid
- A Windows globally unique identifier. A Windows globally unique identifier.
- System
Time - A Windows date and time with millisecond precision. A Windows date and time with millisecond precision.
Enums§
- Error
- An error reported while registering a provider or writing an event.