Roguelazer/rust-syslog-rfc5424

Can't convert to JSON

Closed this issue · 2 comments

vfuse commented

Can't convert syslog to json, here's the result of cargo test on version 0.6.1

cargo 1.33.0 (f099fe94b 2019-02-12)

None of the tests seems to run that use serde_json:

vincent:rust-syslog-rfc5424-0.6.1 2 vincent$ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running target/debug/deps/syslog_rfc5424-85f70d66815039a1

running 19 tests
test facility::tests::test_deref ... ok
test message::tests::test_structured_data_basic ... ok
test parser::tests::test_bad_match ... ok
test message::tests::test_deref_structureddata ... ok
test parser::tests::test_bad_pri ... ok
test parser::tests::test_sd_with_escaped_quote ... ok
test parser::tests::test_simple ... ok
test message::tests::test_fromstr ... ok
test parser::tests::test_complex ... ok
test parser::tests::test_fields_start_with_dash ... ok
test parser::tests::test_empty_sd_value ... ok
test parser::tests::test_sd_features ... ok
test parser::tests::test_other_message ... ok
test parser::tests::test_example_timestamps ... ok
test severity::tests::test_deref ... ok
test parser::tests::test_with_time_offset ... ok
test parser::tests::test_truncated ... ok
test parser::tests::test_with_time_zulu ... ok
test parser::tests::test_with_time_offset_nonzero ... ok

test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests syslog_rfc5424

running 2 tests
test src/lib.rs -  (line 13) ... ok
test src/parser.rs - parser::parse_message (line 374) ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Can you speak a little more to the problem you're having? We have several applications that use this library in conjunction with serde_json, so I'd be kind of surprised if something was broken.

The tests actually do serialize to JSON if you run cargo test --all-features; since the Serde support is an optional feature, it's not run by default if you just run cargo test

vfuse commented

Using the --all-features flag solved it, thanks!