Skip to content

Commit

Permalink
Use a tracing subscriber for LSP logging (#101)
Browse files Browse the repository at this point in the history
* Teach `log::` and tracing::` to send `window/logMessage` messages

* Put logging on its own thread

This completely isolates it, and also allows us to maintain all logging related logic in `logging.rs`

* Tweak existing log usage

* Avoid logging during tests

* Fully switch to tracing over log

Right now we don't even have the "compatibility" log layer turned on

* Send an initial log message with the level

* Check `AIR_LOG` envvar on startup

* Tweak expected option name

* Tweak comment

* Do log during testing, but "captured" by default

- `just test` is silent
- `just test-verbose` is noisy and sequential
- CI is noisy and sequential and `trace` level

* Add intermediate `Trace*` structs with custom `Debug` implementations

* Use `Targets` backed filtering

* Always write the request/notify name at `info!()` level

* Use `pretty()` after all because it is useful with spans

* Write out `AIR_CRATE_NAMES` at build time
  • Loading branch information
DavisVaughan authored Dec 13, 2024
1 parent 9d308f1 commit 093bb96
Show file tree
Hide file tree
Showing 18 changed files with 780 additions and 144 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ jobs:
run: cargo build

- name: Run unit tests
run: cargo test
env:
AIR_LOG_LEVEL: trace
# `--nocapture` to see our own `tracing` logs
# `--test-threads 1` to ensure `tracing` logs aren't interleaved
run: cargo test -- --nocapture --test-threads 1
6 changes: 5 additions & 1 deletion .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ jobs:
run: cargo build

- name: Run unit tests
run: cargo test
env:
AIR_LOG_LEVEL: trace
# `--nocapture` to see our own `tracing` logs
# `--test-threads 1` to ensure `tracing` logs aren't interleaved
run: cargo test -- --nocapture --test-threads 1
6 changes: 5 additions & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ jobs:
run: cargo build

- name: Run unit tests
run: cargo test
env:
AIR_LOG_LEVEL: trace
# `--nocapture` to see our own `tracing` logs
# `--test-threads 1` to ensure `tracing` logs aren't interleaved
run: cargo test -- --nocapture --test-threads 1
227 changes: 226 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 093bb96

Please sign in to comment.