hey hey!
I am lrlna
, a Rust engineer working on a graphql compiler @apollographql. You can find me online on Mastodon. I also make zines, most of which I upload to smol-zines repo here.
Not just a pretty (inter)face: pretty-printer + ndjson logger for log crate.
License: Apache License 2.0
hey hey!
I am lrlna
, a Rust engineer working on a graphql compiler @apollographql. You can find me online on Mastodon. I also make zines, most of which I upload to smol-zines repo here.
rust-lang/cfg-if#31
cfg-if has had a 1.0.0 release with no breaking updates. Femme should be able to update to that version with a patch update. It is always nice to not need multiple versions of the same crate in one's dependency tree, which currently is required for dependents of femme that also require cfg-if 1.0.0.
^ to make sure we don't break upstream dependencies like tide
and async-std
. Plus it's just nice to have CI.
Once rust-lang/log#400 lands our JSON encoding will be broken since string values will no longer be printed as "..."
. This is a bug fix for log
, but we were working around it for our JSON encoding. We should update our JSON encoding once that lands and publish a patch release. Thanks!
I'm curious if this crate has any compatibility with tracing_log
?
It seems that compiling in wasm is not in the test suite, as it fails. I create a PR here: #39
I've been using femme for a while now, and initializing it always requires copying over some boilerplate. I wish we could streamline this slightly:
femme::info()?; // start femme with info log level
femme::trace()?; // start femme with trace level
In addition to that, something that env-logger does well is provide a way to filter messages. In reality these methods should be be a constructor for a Logger
struct that can be further configured.
This would also allow us to trim down the submodules we have. When piping we should always print out ndjson. When printing to stdout we should use the pretty printer.
The "simple" printer becomes a bit of a strange one, but perhaps we don't need it per-se? I'm unsure really. Thoughts would be welcome here. Thanks!
I think the numerical output is similar to some Node.js logger, if I recall?
I think bole.js
outputs as e.g. "level": "info"
, though. json_env_logger
also outputs as text (though, unfortunately as caps, which is also weird.).
An option may be nice, or a build feature.
http-rs/tide#495 (comment) shows that command line output is printed with extra quotes. We should fix this.
{"level":30,"time":1589717147052,"msg":"--> Response sent","method":"\"GET\"","status":"200","duration":"\"157ms\"","path":"\"/api/v1/users\""}
I believe #10 makes some progress towards this by removing the intermediate strings. But we should still do better. And add tests to ensure we catch this. Thanks!
Current released version of femme
lacks quoting around extra kv pairs, I see the it got solved after a recent-ish PR(needs to be released) but I was wondering if writing those kv pairs could be smarter, if I have a string-like value then be quoted but a number-like value for example remain unquoted. Is it something that maybe serde_json
that is already used could solve?
Femme looks quite nice, one feature I'm missing though is to filter out debug messages from some dependencies, I still want to keep the debug
level but not log things from hyper for example.
pub fn with_level(level: log::LevelFilter) {
#[cfg(target_arch = "wasm32")]
wasm::start(level);
#[cfg(not(target_arch = "wasm32"))]
{
// Use ndjson in release mode, pretty logging while debugging.
// here add some cfg! to choose pretty/ndjson
if cfg!(debug_assertions) {
pretty::start(level);
} else {
ndjson::start(level);
}
}
}
Unfortunately your project is missing the LICENSE-MIT
and LICENSE-APACHE
files, which are referenced by the readme. Could you please add them? ๐
IANAL but I believe such files are actually necessary for a project to be considered open-source. ๐ค
Thank you in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.