-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
I have a use case where I'd like to write to an existing std::fs::File
object.
In particular, I have used the Win32 function AllocConsole()
to create a console window for my code, which runs inside of a DLL called from a GUI application. I would like to log to this console. E.g., I have the following function
fn create_console() -> windows::core::Result<File> {
unsafe {
Console::AllocConsole();
let h_stdout = Console::GetStdHandle(Console::STD_OUTPUT_HANDLE)?;
Ok(File::from_raw_handle(h_stdout.0 as *mut libc::c_void))
}
}
I want to log to the File
object returned by this function.
I see that there is a duplicate_to_stdout()
method in flexi_logger, but nothing to duplicate to an arbitrary file. It looks like there's a writers
module but that seems to require implementing an entire trait. Is there a straightforward way to tell flexi_logger to log to a given Write
sink?
Metadata
Metadata
Assignees
Labels
No labels