Skip to content

Commit ebb6754

Browse files
committed
only use in binaries
1 parent 1fc3d91 commit ebb6754

File tree

9 files changed

+34
-16
lines changed

9 files changed

+34
-16
lines changed

crates/cairo-lang-compiler/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ thiserror.workspace = true
2929
[dev-dependencies]
3030
test-log.workspace = true
3131

32+
[features]
33+
env_logger = ["cairo-lang-utils/env_logger"]
34+
3235
[[bin]]
3336
name = "cairo-compile"
3437
path = "src/cli.rs"
38+
required-features = ["env_logger"]

crates/cairo-lang-formatter/Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ repository.workspace = true
66
license-file.workspace = true
77
description = "Cairo formatter."
88

9-
[[bin]]
10-
name = "cairo-format"
11-
path = "src/bin/cli.rs"
12-
139
[dependencies]
1410
anyhow.workspace = true
1511
cairo-lang-diagnostics = { path = "../cairo-lang-diagnostics", version = "1.1.0" }
@@ -27,7 +23,14 @@ salsa.workspace = true
2723
smol_str.workspace = true
2824

2925
[dev-dependencies]
30-
cairo-lang-utils = { path = "../cairo-lang-utils", version = "1.1.0" }
3126
pretty_assertions.workspace = true
3227
test-case.workspace = true
3328
test-log.workspace = true
29+
30+
[features]
31+
env_logger = ["cairo-lang-utils/env_logger"]
32+
33+
[[bin]]
34+
name = "cairo-format"
35+
path = "src/bin/cli.rs"
36+
required-features = ["env_logger"]

crates/cairo-lang-language-server/Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ repository.workspace = true
66
license-file.workspace = true
77
description = "Cairo language server."
88

9-
[[bin]]
10-
name = "cairo-language-server"
11-
path = "src/bin/language_server.rs"
12-
139
[dependencies]
1410
anyhow.workspace = true
1511
cairo-lang-compiler = { path = "../cairo-lang-compiler", version = "1.1.0" }
@@ -39,3 +35,11 @@ tower-lsp.workspace = true
3935

4036
[dev-dependencies]
4137
test-log.workspace = true
38+
39+
[features]
40+
env_logger = ["cairo-lang-utils/env_logger"]
41+
42+
[[bin]]
43+
name = "cairo-language-server"
44+
path = "src/bin/language_server.rs"
45+
required-features = ["env_logger"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use cairo_lang_language_server::serve_language_service;
2+
use cairo_lang_utils::logging::init_logging;
23

34
#[tokio::main]
45
async fn main() {
6+
init_logging(log::LevelFilter::Warn);
57
serve_language_service().await;
68
}

crates/cairo-lang-language-server/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use cairo_lang_syntax::node::kind::SyntaxKind;
4242
use cairo_lang_syntax::node::stable_ptr::SyntaxStablePtr;
4343
use cairo_lang_syntax::node::utils::is_grandparent_of_kind;
4444
use cairo_lang_syntax::node::{ast, SyntaxNode, TypedSyntaxNode};
45-
use cairo_lang_utils::logging::init_logging;
4645
use cairo_lang_utils::ordered_hash_set::OrderedHashSet;
4746
use cairo_lang_utils::{try_extract_matches, OptionHelper, Upcast};
4847
use log::warn;
@@ -69,8 +68,6 @@ pub mod vfs;
6968
const MAX_CRATE_DETECTION_DEPTH: usize = 20;
7069

7170
pub async fn serve_language_service() {
72-
init_logging(log::LevelFilter::Warn);
73-
7471
#[cfg(feature = "runtime-agnostic")]
7572
use tokio_util::compat::{TokioAsyncReadCompatExt, TokioAsyncWriteCompatExt};
7673

crates/cairo-lang-sierra-to-casm/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ repository.workspace = true
66
license-file.workspace = true
77
description = "Emitting of CASM instructions from Sierra code."
88

9-
[features]
10-
testing = []
11-
129
[dependencies]
1310
anyhow.workspace = true
1411
assert_matches.workspace = true
@@ -33,6 +30,11 @@ pretty_assertions.workspace = true
3330
test-case.workspace = true
3431
test-log.workspace = true
3532

33+
[features]
34+
testing = []
35+
env_logger = ["cairo-lang-utils/env_logger"]
36+
3637
[[bin]]
3738
name = "sierra-compile"
3839
path = "src/cli.rs"
40+
required-features = ["env_logger"]

crates/cairo-lang-syntax-codegen/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ xshell.workspace = true
1919
env_logger.workspace = true
2020
test-log.workspace = true
2121

22+
[features]
23+
env_logger = ["cairo-lang-utils/env_logger"]
24+
2225
[[bin]]
2326
name = "generate-syntax"
2427
path = "src/generate_syntax.rs"
28+
required-features = ["env_logger"]

crates/cairo-lang-utils/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ description = "General utilities for the Cairo compiler project."
1010
testing = []
1111

1212
[dependencies]
13-
env_logger.workspace = true
1413
indexmap.workspace = true
1514
itertools.workspace = true
1615
log.workspace = true
@@ -19,8 +18,10 @@ num-integer.workspace = true
1918
num-traits.workspace = true
2019
serde.workspace = true
2120
time.workspace = true
21+
env_logger = { workspace = true, optional = true }
2222

2323
[dev-dependencies]
2424
serde_json.workspace = true
2525
test-case.workspace = true
2626
test-log.workspace = true
27+
env_logger.workspace = true

crates/cairo-lang-utils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub mod collection_arithmetics;
77
pub mod extract_matches;
88
pub mod graph_algos;
99
pub mod iterators;
10+
#[cfg(feature = "env_logger")]
1011
pub mod logging;
1112
pub mod ordered_hash_map;
1213
pub mod ordered_hash_set;

0 commit comments

Comments
 (0)