Skip to content

Commit 009048b

Browse files
committed
posix/sh: add basic logging to the parser
We use `env_logger` to display the messages, which ends up pulling in some heavy crates (e.g. `regex`), so the binary size has increased. We may want to look at other loggers.
1 parent d0f5fb7 commit 009048b

File tree

6 files changed

+205
-54
lines changed

6 files changed

+205
-54
lines changed

Cargo.lock

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ chmod = ["libmesabox/chmod"]
3939
echo = ["libmesabox/echo"]
4040
false = ["libmesabox/false"]
4141
head = ["libmesabox/head"]
42-
sh = ["libmesabox/sh"]
42+
sh = ["libmesabox/sh", "env_logger"]
4343
sleep = ["libmesabox/sleep"]
4444
true = ["libmesabox/true"]
4545
uname = ["libmesabox/uname"]
@@ -97,7 +97,8 @@ default = ["unix"]
9797
[workspace]
9898

9999
[dependencies]
100-
libmesabox = { path = "libmesabox" }
100+
libmesabox = { path = "libmesabox", default-features = false }
101+
env_logger = { version = "0.5.11", optional = true }
101102

102103
[dev-dependencies]
103104
tempfile = "3.0.2"

libmesabox/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ chmod = ["walkdir", "uucore"]
3737
echo = []
3838
false = []
3939
head = []
40-
sh = ["nom", "glob", "rustyline", "libc"]
40+
sh = ["nom", "glob", "rustyline", "libc", "log"]
4141
sleep = ["uucore"]
4242
true = []
4343
uname = ["platform-info"]
@@ -118,3 +118,4 @@ fnv = { version = "1.0.6", optional = true }
118118
nom = { version = "4.0.0", features = ["verbose-errors"], optional = true }
119119
#rustyline = { version = "1.0.0", optional = true }
120120
rustyline = { git = "https://github.com/kkawakam/rustyline", optional = true }
121+
log = { version = "0.4.3", optional = true }

libmesabox/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ extern crate glob;
5252
extern crate platform_info;
5353
#[cfg(feature = "rustyline")]
5454
extern crate rustyline;
55+
#[cfg(feature = "log")]
56+
#[macro_use]
57+
extern crate log;
5558

5659
use clap::{App, SubCommand};
5760
use std::env::{self, VarsOs};

0 commit comments

Comments
 (0)