ovh / rust-gelf_logger

Minimal rust logger to send log entries in GELF.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rust-gelf_logger does not build with latest Rust releases

zenria opened this issue · comments

When trying to use log4rs-gelf, I saw build error coming from this crate, after a clean clone from master here is the errors:

error: trait objects without an explicit `dyn` are deprecated
  --> src/batch.rs:18:38
   |
18 | static mut BATCH_PROCESSOR: &'static Batch = &NoProcessor;
   |                                      ^^^^^ help: use `dyn`: `dyn Batch`
   |
note: lint level defined here
  --> src/lib.rs:75:9
   |
75 | #![deny(warnings, missing_docs)]
   |         ^^^^^^^^
   = note: `#[deny(bare_trait_objects)]` implied by `#[deny(warnings)]`

error: trait objects without an explicit `dyn` are deprecated
  --> src/batch.rs:20:43
   |
20 | pub fn set_boxed_processor(processor: Box<Batch>) -> Result<()> {
   |                                           ^^^^^ help: use `dyn`: `dyn Batch`

error: trait objects without an explicit `dyn` are deprecated
  --> src/batch.rs:24:90
   |
24 | fn set_processor_inner<F>(make_processor: F) -> Result<()> where F: FnOnce() -> &'static Batch {
   |                                                                                          ^^^^^ help: use `dyn`: `dyn Batch`

error: trait objects without an explicit `dyn` are deprecated
   --> src/batch.rs:175:32
    |
175 | pub fn processor() -> &'static Batch { unsafe { BATCH_PROCESSOR } }
    |                                ^^^^^ help: use `dyn`: `dyn Batch`

error[E0308]: match arms have incompatible types
  --> src/formatter.rs:24:31
   |
22 |               additional_fields: match serde_gelf::to_flat_dict(&additional_fields) {
   |  ________________________________-
23 | |                 Err(_) => BTreeMap::new(),
   | |                           --------------- this is found to be of type `std::collections::BTreeMap<std::string::String, serde_value::Value>`
24 | |                 Ok(values) => values
   | |                               ^^^^^^ expected struct `std::string::String`, found enum `serde_value::Value`
25 | |             },
   | |_____________- `match` arms have incompatible types
   |
   = note: expected type `std::collections::BTreeMap<std::string::String, serde_value::Value>`
              found type `std::collections::BTreeMap<serde_value::Value, serde_value::Value>`

error[E0308]: mismatched types
  --> src/formatter.rs:38:39
   |
38 |             .extend_additional_fields(self.default_additional_fields().clone());
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `serde_value::Value`, found struct `std::string::String`
   |
   = note: expected type `std::collections::BTreeMap<serde_value::Value, serde_value::Value>`
              found type `std::collections::BTreeMap<std::string::String, serde_value::Value>`

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `gelf_logger`.

Two problems: trait objects must have dyn keywords.

Published dependency serde_gelf has another api than the one expected in the code.

Hi,
Published the 0.1.3 which may fix your problems.

@zenria sorry for your PR, we already fixed those problems but we forget to update the github repository.