195 Commits

Author SHA1 Message Date
Yoshua Wuyts
9fdb238af7
inline docs for kv::value
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-01 11:54:34 +02:00
Rotem Yaari
eafc1ac916 Fix documentation for static max_level_xxx filters
closes #348
2019-08-22 07:20:54 +03:00
Do Duy
cfa10a4749
Fix struct's name in documentation 2019-08-20 14:15:56 +07:00
Ashley Mannix
782d4f7cf1 prepare for 0.4.8 release 2019-07-28 10:59:59 +10:00
Steven Fackler
459c59ea0f Dynamically track the 'static-ness of record strings
Logger implementations commonly need to convert a `Record` into a
non-borrowed form to e.g. log it asynchronously on a separate thread.
This allows them to avoid having to allocate owned `String`s for the
module path and file fields, which will in practice almost always be
`'static`.

cc #206
2019-07-26 20:37:21 -07:00
Ashley Mannix
368a7777dc test sval feature in CI
split consumer builds of MSRV from dev builds
2019-07-17 09:39:58 +10:00
Ashley Mannix
06beb05c42 add sval support for Value
bump to 1.31.0
2019-07-16 14:31:40 +10:00
Ashley Mannix
15ccf07784 refactor value layout for easier additional frameworks 2019-07-16 14:27:57 +10:00
Ashley Mannix
af184520e8 prepare for 0.4.7 release 2019-07-06 11:59:53 +10:00
Ashley Mannix
9b71d367a0
Make it easier to create a Value from owned or erased external types (#339)
* refactor Value internals to avoid needing to buffer

that means doing two things:

1. allowing us to create a value with any lifetime from some owned
primitive, like u8, bool etc
2. allowing us to create a value from some type that _can_ produce
a concrete value we can use, but doesn't guarantee it will live as
long as the value itself

* add test for Fill
2019-07-06 11:41:32 +10:00
Ashley Mannix
d85209f218
Merge pull request #337 from tmccombs/std-kv-sources
Add impls for Source for HashMap and BTreeMap
2019-07-04 07:52:32 +10:00
Thayne McCombs
86748c8f19 Fix error with rustc 1.21 2019-07-01 12:29:32 -06:00
Thayne McCombs
506167c3e7 Add impls for Source for HashMap and BTreeMap 2019-07-01 12:24:00 -06:00
Thayne McCombs
e81509fab1 Add conversion to/from io::Error for kv::Error
And keep the original error, so that an io error inside the visitor is
returned accessible by the call to `visit`.
2019-07-01 11:37:12 -06:00
Ashley Mannix
11ba139652 add a Source::get method for finding a single value 2019-06-28 13:03:16 +10:00
John Drinkwater
f9eb14c8a1 Respect padding for LevelFilter Display
This mirrors a similar commit fe073054a0999d1bb238cb0293757741e95b3588
that changed output for Level, it seems sensible if the user wishes to
output the logging filter level to afford the same formatting choices.
2019-05-16 11:10:40 +01:00
David Tolnay
0f3ffb9d05
Update documentation to 2018 edition 2019-04-30 01:33:31 -07:00
David Tolnay
41193b9223
Clean up trailing whitespace 2019-04-30 01:33:21 -07:00
Ashley Mannix
cd690d1607
Add a count method to Source (#329) 2019-04-30 12:16:50 +10:00
Ashley Mannix
84fffab7f0
Build out initial key values API (#324) 2019-04-29 14:32:30 +10:00
Jonas Schievink
0f4bdaa17a Address documentation nits 2019-03-25 11:14:15 +01:00
Jonas Schievink
3d9bf60ff4 Clarify safety conditions of set_logger_racy 2019-03-19 13:21:04 +01:00
Jonas Schievink
b74bc7821f Support thumbv6 by providing a thread-unsafe initialization function 2019-03-18 23:13:07 +01:00
David Tolnay
ce64c06a37
Format with rustfmt 2019-02-14 2019-03-09 16:15:10 -08:00
David Tolnay
c69948d391
Improve error when missing macro argument
The log! macro matches part of its arguments as $($arg:tt)+, but the other
macros match it as $($arg:tt)*. That means if a user calls error!() or any of
the other macros with an empty argument, it successfully matches the macro rules
of the first macro they called but then turns into an invalid call to log!,
leading to a confusing error message.

This PR uses $($arg:tt)+ consistently to match arguments.

Example:

    use log::error;

    fn main() {
        error!();
    }

Before:

    error: expected identifier, found `,`
     --> src/main.rs:4:5
      |
    4 |     error!();
      |     ^^^^^^^^^
      |     |
      |     expected identifier
      |     help: remove this comma
      |
      = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

After:

    error: unexpected end of macro invocation
     --> src/main.rs:4:5
      |
    4 |     error!();
      |     ^^^^^^^^^ missing tokens in macro arguments
2019-03-09 15:51:46 -08:00
David Kellum
48dcb095f6 Silence deprecation warning for ATOMIC_USIZE_INIT
ATOMIC_USIZE_INIT was deprecated in rust 1.34. Silence the deprecation
warning until our MSRV >= 1.24, where we can use the replacement const
fn `AtomicUsize::new`

github: fixes #320
2019-02-03 09:24:34 -08:00
Ashley Mannix
3a50f25acf add a note to avoid setting max levels 2019-01-02 09:55:49 +10:00
David Tolnay
1a9a8275f5
Release 0.4.6 2018-10-27 12:05:53 -07:00
Linus Färnstrand
2f52d6ce91 Fix so log_enabled can be used without #[macro_use] 2018-10-27 20:52:10 +02:00
David Tolnay
d711a6bf48
Release 0.4.5 2018-09-03 08:58:33 -07:00
David Tolnay
da920f8637
Make private helper macro names less likely to conflict 2018-09-03 08:05:47 -07:00
David Tolnay
5602967f47
Release 0.4.4 2018-08-17 07:51:52 -07:00
David Tolnay
11dfde1a29
Use local_inner_macros to resolve all local macros within $crate
This fixes the following error when using Rust 2018 style macro imports.

    use log::info;

    fn main() {
        info!("...");
    }

    error: cannot find macro `log!` in this scope
     --> src/main.rs:4:5
      |
    4 |     info!("...");
      |     ^^^^^^^^^^^^^

The `local_inner_macros` modifier resolves all macro invocations made
from within that macro as macros in the same crate. So if `info!`
expands to an invocation of `log!` then this would be resolved as
`$crate::log!` rather than requiring the caller to have `log` in scope.

The attribute is ignored by pre-2018 compilers so log will continue to
work as normal with #[macro_use].

In the future when dropping compatibility with pre-2018 compilers we can
remove the `local_inner_macros` modifier and use our own explicit
`$crate::` prefixes on invocations of local macros.
2018-08-16 23:55:56 -07:00
Dan Gohman
7e443a0d9d Remove the call to spin_loop_hint.
It isn't available on Rust 1.16.
2018-08-01 13:04:20 -07:00
Dan Gohman
637ae01b62 Ensure that initialization is complete after set_logger_inner.
If `set_logger_inner` is called while `STATE` is `INITIALIZING`, make it
wait until the `STATE` is `INITIALIZED` so that callers can assume that
the logging state is fully initialized after a call to
`set_logger_inner`.
2018-08-01 12:38:48 -07:00
Pyry Kontio
05ace3b7ec
Updated the log level explanation text 2018-06-28 21:28:32 +09:00
Pyry Kontio
7a9ff7fe12 Elaborated documentation around log levels. 2018-06-18 12:29:22 +03:00
Amanieu d'Antras
8d79b7476f Further improve code size for log macros 2018-06-09 02:51:17 +01:00
Amanieu d'Antras
815e309618 Improve code generation when comparing log levels 2018-06-09 02:26:14 +01:00
Steven Fackler
ffeb0ee505 Release 0.4.2 2018-06-05 19:51:43 -07:00
Steven Fackler
b16b5add69
Merge pull request #276 from sfackler/codegen
Optimize logging codegen
2018-06-04 22:40:02 -07:00
Ashley Mannix
8fcf3c2971
Merge pull request #274 from cowang4/master
Added Crate Feature Flags Documentation
2018-06-04 07:52:26 +10:00
Steven Fackler
8ca698f0a2 Optimize logging codegen
The extra work involved in loading the logger and creating the record
struct involves move codegen than is necessary if we take this kind of
approach (which we previously used in 0.3). It's a bit unfortunate to
have these public-but-not-public functions, but I think it's worth it.
We want to minimize the footprint of logging so people feel comfortable
using it!

A main function containing nothing but `warn!("hello world")` shrinks
from 204 bytes to 124 bytes in x86_64 with this change.

Closes #275
2018-06-03 10:58:52 -07:00
Greg Cowan
dc581888d9 backticks set_boxed_logger 2018-05-30 19:02:29 -04:00
Greg Cowan
24e151edd9 added crate feature flags documentation 2018-05-29 23:18:23 -04:00
Michal 'vorner' Vaner
3ed9a8e3a3
Shaving mutates the yak 2018-05-29 19:53:56 +02:00
Luke Horsley
3bd1f4e348 Better handling for deserializing invalid slices 2018-04-08 12:18:38 +01:00
Luke Horsley
033e46b1a2 Level and LevelFilter can now be deserialized from byte slices
This is required by some deserializers which deserialize identifiers using their binary representation.

This implementation should be equivalent to what serde derive would implement.
2018-04-08 11:59:07 +01:00
Steven Fackler
bdff1b0fd8 Fix max log level documentation
Closes #259
2018-02-09 21:53:51 -08:00
Malo Jaffré
ebc7f052f4 Fix broken links and bump the version to 0.4.1
Unblocks rust-lang/rust#46278.
2017-12-30 23:46:26 +01:00