-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize and document __log
.
#95
Comments
|
The content of |
I'm a bit confused - why do you need to use |
RIght. Hmm... Will there be any other addition? I mean - one could just add |
Who knows? |
Can't then |
Bumping the major version of |
FYI, the only reason |
I have a need to log things with custom meta information using And it seems to me it's reasonable requirement, as "faking" line/file/module might be useful in some cases, when people don't want real information for whatever reason. What if |
The functionality here seems pretty reasonable to me, integrating one log system into another. Stabilizing exactly I wonder if we could perhaps explore a more first class API here? Something like: struct LogBuilder {
// opaque
}
impl LogBuilder {
fn new() -> LogBuilder { ... }
fn line(&mut self, line: u32) -> &mut LogBuilder { ... }
fn module(&mut self, module: &str) -> &mut LogBuilder { ... }
// other builder methods ...
fn emit(&mut self) { ... }
} This way slog and other libraries could programmatically build log structures and the Thoughts? |
We'd need to change that API a bit since line, module, etc are already required, unless we'd have emit panic which seems unfortunate. |
Perhaps yeah, although we could also just add arguments to |
Anything wrong with versioned |
I personally much prefer extensible APIs to "versioned APIs". That way everyone always has the same ergonomic experience and it's not a huge diff to use new features. |
Yes, normally me to. But in that case the API is kind of a backdoor anyway, and except few people noone can see it anyway. My concerns are:
If the above are not an issue, then Builder is clearly nicer. |
Oh I wasn't worried about perf here because I figured that once you hit this point you've concluded "yes a log should happen" and whatever happens there will completely dwarf some code to assemble the message. It's true yeah though that if a builder were stabilized we'd have to be very confident that it would be sufficient for an incredibly long time. I'm pretty confident in this, though, as the builders in the standard library have worked out very well so far. |
Fixed by #211. |
Previously this API was required to work around rust-lang/log#95 Thanks to the inclusion of a `RecordBuilder` (PR rust-lang/log#211) it is no longer required. This fixes slog-rs/slog#309 This supersedes PR slog-rs#20 I have added a comment about supporting the log/kv_unstable feature in the future. Not supporting this feature doesn't break backwards compat, because the old usage of the private API didn't support it either. Therefore, this new code doesn't break or remove anything that was already existing. However,from a feature-completeness standpoint it would be nice to have this in the future.
Previously this API was required to work around rust-lang/log#95 Thanks to the inclusion of a `RecordBuilder` (PR rust-lang/log#211) it is no longer required. This fixes slog-rs/slog#309 This supersedes PR slog-rs#20 I have added a comment about supporting the log/kv_unstable feature in the future. Not supporting this feature doesn't break backwards compat, because the old usage of the private API didn't support it either. Therefore, this new code doesn't break or remove anything that was already existing. However,from a feature-completeness standpoint it would be nice to have this in the future. (see comment in code)
This from feedback in rust-lang#19: > wrt. bin-dir and bin-path, this appears to be a typo / should all be called bin-dir This is only a readme fix afaict, I changed all occurences of `bin-path` in there to `bin-dir`. > wrt. format, those are actually two (unfortunately named) different concepts, the first refers to the archive format (eg. .tgz), the second to the binary format (which needs a .exe appended for windows). This introduces two new substitutions: - `binary-ext` is the old "`format` in `bin-dir`" - `archive-format` is the old "`format` in `pkg-url`" Contents are unchanged: `binary-ext` includes the dot, `archive-format` doesn't. That makes it easy to upgrade and also personally I slightly prefer it that way. The old contextual `format` is still available, "soft deprecated": it will be accepted silently so everything will work, but all documentation will use the new syntax. In the future we could move to a "hard deprecated" model where installing a package that uses `format` will warn the user / tell them to report that to the maintainer. I don't think we'll ever really be able to remove it but that should be good enough. A cool new feature is that `binary-ext` is now usable in `pkg-url`, which will be useful for raw binary downloads: ```toml pkg_url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-{ target }{ binary-ext }" ``` I've also added a bunch of tests to GhCrateMeta around the templating for `pkg-url`.
Sometimes needs arise where one wants to deliver a custom logging statement to
log
crate.__log
is exactly that function, but then anyone using it is risking breaking changes.It seems to me once
log
API is considered stable,__log
should be documented and stabilized as well.The text was updated successfully, but these errors were encountered: