Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ jobs:
- name: Tests all targets all features
run: cargo test --lib --workspace --all-targets --all-features

wasm-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.90.0
targets: wasm32-unknown-unknown
- name: Build cosmian_logger for wasm32-unknown-unknown
run: cargo build --target wasm32-unknown-unknown -p cosmian_logger

cargo-lint:
uses: Cosmian/reusable_workflows/.github/workflows/cargo-lint.yml@develop
with:
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# pre-commit install
# pre-commit install --install-hooks -t commit-msg
# pre-commit autoupdate
# rustup target add wasm32-unknown-unknown
#
# (optional) Creating a virtual environment
# ```
Expand Down Expand Up @@ -148,3 +149,9 @@ repos:
language: system
pass_filenames: false
always_run: true
- id: wasm-build-cosmian-logger
name: WASM build - cosmian_logger
entry: cargo build --target wasm32-unknown-unknown -p cosmian_logger
language: system
pass_filenames: false
files: ^crate/logger/
27 changes: 14 additions & 13 deletions crate/logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,33 @@ license.workspace = true

[dependencies]
opentelemetry = "0.32"
opentelemetry-semantic-conventions = "0.32"
thiserror = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = [
"ansi",
"env-filter",
"fmt",
"std"
] }

# The following crates rely on tokio, tonic, or Unix-specific syscalls that do
# not compile on wasm32.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
opentelemetry-appender-tracing = "0.32"
opentelemetry-otlp = { version = "0.32", features = [
"metrics",
"logs",
"grpc-tonic"
] }
opentelemetry-semantic-conventions = "0.32"
opentelemetry_sdk = { version = "0.32", features = [
"metrics",
"logs",
"rt-tokio"
] }
thiserror = { workspace = true }
syslog-tracing = "0.3"
tracing = { workspace = true }
tracing-opentelemetry = { version = "0.33" }
tracing-subscriber = { workspace = true, features = [
"ansi",
"env-filter",
"fmt",
"std"
] }

# tracing-appender uses platform-specific file rotation that does not compile on wasm32.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tracing-appender = { workspace = true }
tracing-opentelemetry = { version = "0.33" }

[dev-dependencies]
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
Expand Down
3 changes: 3 additions & 0 deletions crate/logger/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/// Errors that can occur while initialising or configuring the logging stack.
#[derive(Debug, thiserror::Error)]
pub enum LoggingError {
#[cfg(not(target_arch = "wasm32"))]
#[error("failed to build OTLP span exporter: {0}")]
SpanExporter(#[source] opentelemetry_otlp::ExporterBuildError),

#[cfg(not(target_arch = "wasm32"))]
#[error("failed to build OTLP log exporter: {0}")]
LogExporter(#[source] opentelemetry_otlp::ExporterBuildError),

#[cfg(not(target_arch = "wasm32"))]
#[error("failed to build OTLP metric exporter: {0}")]
MetricExporter(#[source] opentelemetry_otlp::ExporterBuildError),

Expand Down
Loading
Loading