Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaslyang authored and nicholaslyang committed Aug 8, 2023
1 parent 894f332 commit 864e573
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/turborepo-ui/src/log_replayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ use std::{
io::{BufRead, BufReader, Write},
};

use console::style;
use tracing::{debug, warn};
use turbopath::AbsoluteSystemPath;

use crate::{Error, StyledObject, UI};

#[allow(dead_code)]
pub struct PrefixedUI<D: Display, W: Write> {
pub struct PrefixedUI<D: Display + Clone, W: Write> {
ui: UI,
prefix: StyledObject<D>,
output: W,
}

#[allow(dead_code)]
impl<D: Display, W: Write> PrefixedUI<D, W> {
impl<D: Display + Clone, W: Write> PrefixedUI<D, W> {
pub fn new(ui: UI, prefix: StyledObject<D>, output: W) -> Self {
Self { ui, prefix, output }
}

pub fn output(&mut self, message: impl Into<String>) -> Result<(), Error> {
let message = style(format!("{} {}", self.prefix, message.into()));
writeln!(self.output, "{}", self.ui.apply(message)).map_err(Error::CannotWriteLogs)?;
pub fn output(&mut self, message: impl Display) -> Result<(), Error> {
write!(self.output, "{} ", self.ui.apply(self.prefix.clone()))
.map_err(Error::CannotWriteLogs)?;
writeln!(self.output, "{}", message).map_err(Error::CannotWriteLogs)?;

Ok(())
}
}

#[allow(dead_code)]
pub fn replay_logs<D: Display, W: Write>(
pub fn replay_logs<D: Display + Clone, W: Write>(
mut output: PrefixedUI<D, W>,
log_file_name: &AbsoluteSystemPath,
) -> Result<(), Error> {
Expand Down

0 comments on commit 864e573

Please sign in to comment.