paavohtl Claude Opus 4.6 (1M context) commited on
Commit
ff1ae87
·
1 Parent(s): 0bcdcfa

refactor: move log_line to openwa-core for shared logging

Browse files

Move log_line() from openwa-wormkit to openwa_core::log so that core
types (e.g. DSSound::load_wav) can emit debug logging. openwa-wormkit
re-exports via pub use.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

crates/openwa-core/src/lib.rs CHANGED
@@ -11,6 +11,7 @@ pub mod input;
11
  pub mod render;
12
 
13
  pub mod fixed;
 
14
  pub mod task;
15
  pub mod address;
16
  pub mod rebase;
 
11
  pub mod render;
12
 
13
  pub mod fixed;
14
+ pub mod log;
15
  pub mod task;
16
  pub mod address;
17
  pub mod rebase;
crates/openwa-core/src/log.rs ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //! Shared logging — writes to `OpenWA.log` in the working directory.
2
+
3
+ /// Append a line to `OpenWA.log`.
4
+ pub fn log_line(msg: &str) -> std::io::Result<()> {
5
+ use std::io::Write;
6
+ let mut f = std::fs::OpenOptions::new()
7
+ .create(true)
8
+ .append(true)
9
+ .open("OpenWA.log")?;
10
+ writeln!(f, "{msg}")?;
11
+ Ok(())
12
+ }
crates/openwa-wormkit/src/lib.rs CHANGED
@@ -38,15 +38,7 @@ unsafe extern "system" fn DllMain(
38
  // Logging
39
  // ---------------------------------------------------------------------------
40
 
41
- pub fn log_line(msg: &str) -> std::io::Result<()> {
42
- use std::io::Write;
43
- let mut f = std::fs::OpenOptions::new()
44
- .create(true)
45
- .append(true)
46
- .open("OpenWA.log")?;
47
- writeln!(f, "{msg}")?;
48
- Ok(())
49
- }
50
 
51
  fn clear_log() -> std::io::Result<()> {
52
  std::fs::write("OpenWA.log", "")?;
 
38
  // Logging
39
  // ---------------------------------------------------------------------------
40
 
41
+ pub use openwa_core::log::log_line;
 
 
 
 
 
 
 
 
42
 
43
  fn clear_log() -> std::io::Result<()> {
44
  std::fs::write("OpenWA.log", "")?;