1 unstable release

0.1.0 Apr 2, 2020

#724 in Debugging

Download history 61/week @ 2023-12-18 25/week @ 2023-12-25 13/week @ 2024-01-01 31/week @ 2024-01-08 32/week @ 2024-01-15 23/week @ 2024-01-22 38/week @ 2024-01-29 34/week @ 2024-02-05 39/week @ 2024-02-12 45/week @ 2024-02-19 64/week @ 2024-02-26 135/week @ 2024-03-04 335/week @ 2024-03-11 389/week @ 2024-03-18 193/week @ 2024-03-25 274/week @ 2024-04-01

1,205 downloads per month

MIT/Apache

8KB
72 lines

A logger for use with Windows debuggers.

Windows allows applications to output a string directly to debuggers. This is very useful in situations where other forms of logging are not available. For example, stderr is not available for GUI apps.

Windows provides the OutputDebugString entry point, which allows apps to print a debug string. Internally, OutputDebugString is implemented by raising an SEH exception, which the debugger catches and handles.

Raising an exception has a significant cost, when run under a debugger, because the debugger halts all threads in the target process. So you should avoid using this logger for high rates of output, because doing so will slow down your app.

Like many Windows entry points, OutputDebugString is actually two entry points: OutputDebugStringA (multi-byte encodings) and OutputDebugStringW (UTF-16). In most cases, the *A version is implemented using a "thunk" which converts its arguments to UTF-16 and then calls the *W version. However, OutputDebugStringA is one of the few entry points where the opposite is true.

This crate can be compiled and used on non-Windows platforms, but it does nothing. This is intended to minimize the impact on code that takes a dependency on this crate.

Dependencies

~87KB