73 Commits

Author SHA1 Message Date
tison
50c2018d50
fixup running IT cases
Signed-off-by: tison <wander4096@gmail.com>
2025-03-25 07:10:34 +08:00
tison
e52ac8d10f
ci: drop really old trick and use new actions
Signed-off-by: tison <wander4096@gmail.com>
2025-03-24 08:54:57 +08:00
KodrAus
02486e458c fill in more tests for logger argument 2025-03-24 05:56:21 +10:00
KodrAus
71e034ffa6 expand logger tests 2025-03-24 05:45:35 +10:00
tison
088f9f35ea
address comments
Signed-off-by: tison <wander4096@gmail.com>
2025-03-21 15:18:31 +08:00
tison
cde2585932
allows us to pass zero-sized logger
Signed-off-by: tison <wander4096@gmail.com>
2025-02-27 21:50:48 +08:00
tison
c300df0945
Merge branch 'master' into logger-field 2025-02-25 17:11:55 +08:00
Yuri Astrakhan
98dc73f3d8 A few minor lint fixes 2025-02-20 20:48:22 -05:00
tison
dd835fe38e
fixup msrv tests
Signed-off-by: tison <wander4096@gmail.com>
2025-02-01 17:42:57 +08:00
tison
a3f72c8fbe
separate logger
Signed-off-by: tison <wander4096@gmail.com>
2025-02-01 16:06:19 +08:00
kleinmarb
0aaa10df46 Fix some typos 2024-07-31 22:35:17 +02:00
KodrAus
507b672660 loosen orderings for logger initialization 2024-06-25 11:02:26 +10:00
Divkov575
3aea361cff fmt + change test harness + remove (unnecessary) lazy_static from dev-deps 2024-03-24 10:59:20 -04:00
Divkov575
36b1a1cac9 combined tests test_filter & test_line_number -> 1 main function 2024-03-24 10:39:34 -04:00
Divkov575
90edfc3b17 (filters.rs & line_numbers.rs -> integration.rs) 2024-03-22 21:02:17 -04:00
Divkov575
8f79efefa1 removed harness from line_numbers test 2024-03-19 12:41:41 -04:00
Divkov575
d94009e432 added line_numbers test to cargo.toml and lib.rs 2024-03-19 11:43:59 -04:00
Divkov575
cffcd66e54 fmt + update line# for assertion 2024-03-19 08:02:36 -04:00
Divkov575
8e1fa960a5 added checks for log filtering + set_max_level log 2024-03-19 08:00:22 -04:00
Divkov575
eeaeeb80bd extra option wrapping record.lien() on line 21 removed 2024-03-16 13:02:06 -04:00
Divkov575
96c3fdc9ad changed state<Record> to state<u32> in order to store line number only 2024-03-16 10:47:58 -04:00
Divkov575
d9f4a65678 added line_numbers.rs 2024-03-16 10:23:11 -04:00
KodrAus
ad917118a5 support field shorthand in macros 2024-02-19 07:36:01 +10:00
KodrAus
52460f9928 stabilize the kv features 2024-02-16 15:40:52 +10:00
KodrAus
0374a25554 work on macro support for capturing 2024-02-13 20:07:58 +10:00
Yuri Astrakhan
3237ff77f8 Update docs to 2021 edition, test
* Inline format arg in documentation and a few call places
* Add a unit test for inlined format args

I was surprised to discover that log crate has no edition value... Any reason to keep it at 2015?
2023-10-21 17:36:19 -04:00
Yuri Astrakhan
31b683d49f Set all crates to 2021 edition 2023-08-20 21:28:46 -04:00
Yuri Astrakhan
32d440a968 Minor clippy nits
* Fix semicolons (pedantic)
* Don't duplicate var name for instantiation if not needed
* Use `mar_or` instead of `map.unwrap_or`
2023-08-20 02:26:44 -04:00
Thomas de Zeeuw
472e8f0952 Fix implicit_named_args test
When kv_unstable is not enabled.
2023-07-03 11:52:51 +02:00
Thomas de Zeeuw
a556b46d39 Remove rustversion dev-dependency
Since the MSRV is now 1.60.
2023-07-03 11:33:29 +02:00
Ashley Mannix
d9f0939a9e
Merge branch 'master' into clippy_lints 2022-06-03 08:59:27 +10:00
Marcel Hellwig
4b52024d74 apply clippy lints 2022-05-31 14:22:36 +02:00
KodrAus
bb111eb90d add a macro test with common types 2022-04-20 16:27:06 +10:00
Ashley Mannix
06380b99cd fully qualify Type import for MSRV 2022-03-22 23:52:16 +10:00
Thomas de Zeeuw
0b90513e65 Fully qualify Some and None 2022-03-22 14:01:09 +01:00
Thomas de Zeeuw
c626f82520 Support static string as key value 2022-02-26 12:28:43 +01:00
Ashley Mannix
26aef64c46 fix up kv examples 2021-12-23 15:13:42 +10:00
Ashley Mannix
699afffdc0 revert requirement for target = in kv macros 2021-12-23 15:07:25 +10:00
KodrAus
505c255f0a try putting attribute on fn 2021-12-12 11:20:05 +10:00
KodrAus
7ed6401b93 run fmt 2021-12-12 11:13:26 +10:00
KodrAus
d6e44eb253 add an expr test to macros 2021-12-12 11:02:50 +10:00
KodrAus
13b9dbcef1 add a different prop type to macro tests 2021-12-12 11:00:46 +10:00
KodrAus
77667f5436 move implicit arg tests into module 2021-12-12 10:57:45 +10:00
Ashley Mannix
62c6607b25 allow macros to be more consistent with kvs 2021-12-07 22:48:47 +10:00
Ashley Mannix
77ae39bfc7 fix up some links and tests 2021-12-07 20:05:11 +10:00
KodrAus
c68890197d fix tests when running with --all-features 2021-11-15 16:59:00 +10:00
Thomas de Zeeuw
e49f063235 Add key-values to the macros
Attempt number two/three? Too many in any case.

Previously I proposed a design that followed a `struct` like syntax:

```rust
info!("my message: {}", arg, {
    key1: "value1",
    key2: 123,
});
```

However it turns out that this does not work well with named arguments
as reported in issues #369 and #372. The implementation was eventually
reverted in pr #374.

This new design takes inspiration from the `tracing` crate which already
supports key-value pairs in logging events. The basic idea is to put the
key-value pairs before the message and arguments. Applying the same
structure like syntax as above we would get something like the
following.

```rust
info!({
    key1: "value1",
    key2: 123,
}, "my message: {}", arg);
```

But personally I'm not a big fan of this formatting, let's try putting
everything on a single line instead.

```rust
info!({ key1: "value1", key2: 123 }, "my message: {}", arg);
```

A little better, but at this point the structure like syntax is really
more annoying then helpful. So, instead I've done away it, opting
instead use the following syntax.

```rust
info!(key1 = "value1", key2 = 123, "my message: {}", arg);
```

Two major differences:
 * Removed the brackets.
 * Colons (`:`) are replaced with equal/assignment signs (`=`).

This gives us syntax similar to variable assignment.

But then we run in some limitations of the macro syntax, specifically
that `expr` fragments aren't allowed after `expr` fragments. To fix this
I went with the easiest option of changing the last comma (`,`) after
the key-value pairs to a semicolon (`;`). Making the final syntax look
like the following.

```rust
info!(key1 = "value1", key2 = 123; "my message: {}", arg);
info!(target: "my_target", key1 = "value1", key2 = 123; "my message: {}", arg);
log!(target: "my_target", log::Level::Info, key1 = "value1", key2 = 123; "my message: {}", arg);
```

Which, in my opinion and all things considered, it's too bad looking.
2021-08-29 14:22:22 +02:00
Ashley Mannix
0e78c11b40
Run tests in our MSRV (#427) 2020-12-21 16:44:59 +10:00
Ashley Mannix
c3a9a14c58 revert to old macro impl for now 2019-12-19 07:15:14 +10:00
Ashley Mannix
bb0224c120 add test for named format args 2019-12-19 07:11:56 +10:00