Geal / rust-syslog

Send syslog messages from Rust
MIT License
110 stars 55 forks source link

Make LogFormat trait public? #40

Closed daboross closed 5 years ago

daboross commented 6 years ago

Right now, the public interface of Logger takes in messages of a type variable T. There's no other reference in the documentation for what this type is, or what kind of things are LogFormat (I assume Formatter3164 and Formatter5424 are, but there is no hint or information from the documentation which indicates this).

Could we possibly have the LogFormat trait be public, or at least make some sub-trait of it public?

If the goal of having it private is to prevent breaking changes, then it could be changed to a pair of traits like:

// public trait, exported to crate root
pub trait LogFormat<T>: intentionally_private::LogFormat { }
mod intentionally_private {
    pub LogFormat {
        // actual methods here
    }
}
// all formatters implementing LogFormat implement both traits, so the public trait will show up in the documentation.
// anything requiring LogFormat publicly requires the outer `LogFormat`, not `intentionally_private::LogFormat`
Geal commented 5 years ago

done in eaff7af. That was a mistake on my part, it should have been public from the beginning