Skip to content

Commit 58bce5d

Browse files
committed
feat(fmt): Expose ConfigurableFormat
1 parent 4b73642 commit 58bce5d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/fmt/mod.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,9 @@ impl<T: Display> Display for StyledValue<T> {
287287
#[cfg(not(feature = "color"))]
288288
type StyledValue<T> = T;
289289

290-
/// The default format.
291-
///
292-
/// This format needs to work with any combination of crate features.
293-
pub(crate) struct ConfigurableFormat {
290+
/// A [`RecordFormat`] with settings for which fields to show
291+
pub struct ConfigurableFormat {
292+
// This format needs to work with any combination of crate features.
294293
pub(crate) timestamp: Option<TimestampPrecision>,
295294
pub(crate) module_path: bool,
296295
pub(crate) target: bool,
@@ -305,52 +304,52 @@ pub(crate) struct ConfigurableFormat {
305304

306305
impl ConfigurableFormat {
307306
/// Whether or not to write the level in the default format.
308-
pub(crate) fn level(&mut self, write: bool) -> &mut Self {
307+
pub fn level(&mut self, write: bool) -> &mut Self {
309308
self.level = write;
310309
self
311310
}
312311

313312
/// Whether or not to write the source file path in the default format.
314-
pub(crate) fn file(&mut self, write: bool) -> &mut Self {
313+
pub fn file(&mut self, write: bool) -> &mut Self {
315314
self.source_file = write;
316315
self
317316
}
318317

319318
/// Whether or not to write the source line number path in the default format.
320319
///
321320
/// Only has effect if `format_file` is also enabled
322-
pub(crate) fn line_number(&mut self, write: bool) -> &mut Self {
321+
pub fn line_number(&mut self, write: bool) -> &mut Self {
323322
self.source_line_number = write;
324323
self
325324
}
326325

327326
/// Whether or not to write the module path in the default format.
328-
pub(crate) fn module_path(&mut self, write: bool) -> &mut Self {
327+
pub fn module_path(&mut self, write: bool) -> &mut Self {
329328
self.module_path = write;
330329
self
331330
}
332331

333332
/// Whether or not to write the target in the default format.
334-
pub(crate) fn target(&mut self, write: bool) -> &mut Self {
333+
pub fn target(&mut self, write: bool) -> &mut Self {
335334
self.target = write;
336335
self
337336
}
338337

339338
/// Configures the amount of spaces to use to indent multiline log records.
340339
/// A value of `None` disables any kind of indentation.
341-
pub(crate) fn indent(&mut self, indent: Option<usize>) -> &mut Self {
340+
pub fn indent(&mut self, indent: Option<usize>) -> &mut Self {
342341
self.indent = indent;
343342
self
344343
}
345344

346345
/// Configures if timestamp should be included and in what precision.
347-
pub(crate) fn timestamp(&mut self, timestamp: Option<TimestampPrecision>) -> &mut Self {
346+
pub fn timestamp(&mut self, timestamp: Option<TimestampPrecision>) -> &mut Self {
348347
self.timestamp = timestamp;
349348
self
350349
}
351350

352351
/// Configures the end of line suffix.
353-
pub(crate) fn suffix(&mut self, suffix: &'static str) -> &mut Self {
352+
pub fn suffix(&mut self, suffix: &'static str) -> &mut Self {
354353
self.suffix = suffix;
355354
self
356355
}
@@ -366,7 +365,7 @@ impl ConfigurableFormat {
366365
/// The default format uses a space to separate each key-value pair, with an "=" between
367366
/// the key and value.
368367
#[cfg(feature = "kv")]
369-
pub(crate) fn key_values<F>(&mut self, format: F) -> &mut Self
368+
pub fn key_values<F>(&mut self, format: F) -> &mut Self
370369
where
371370
F: Fn(&mut Formatter, &dyn log::kv::Source) -> io::Result<()> + Sync + Send + 'static,
372371
{

0 commit comments

Comments
 (0)