How to fix: cast requires that `'1` must outliv e `'static`

I am trying to test a solution provided in the blog post.. I fixed almost all errors in the example

struct MyLogger {
    level: u8,
    output: Box<dyn std::io::Write>,
}
impl MyLogger {
    fn new(level: u8, output: &mut dyn std::io::Write) -> Self {
        Self { level, output: Box::new(output) }
    }
    fn log(&mut self, level: u8, message: &str) {
        if self.level <= level {
            writeln!(self.output, "{}", message).unwrap();
        }
    }
}
fn main() {
    let mut output = std::io::stdout();
    let mut my_logger = MyLogger::new(8_u8, &mut output);
    my_logger.log(1, "Hello world!")
}

However one error didn't go away

error: lifetime may not live long enough
 --> main.rs:7:31
  |
6 |     fn new(level: u8, o

utput: &mut dyn std::io::Write) -> Self {
  |                               - let's call the lifetime of this reference `'1`
7 

|         Self { level, output: Box::new(output) }
  |                               ^^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`

error: aborting due to 1 previous error

There are several similar posts in the forum, however the context looks a bit different.

You have to add a lifetime parameter to MyLogger for the output field (at which point you might as well store a &'a mut dyn Write instead of a Box<dyn Write + 'a>).