def METHOD_NAME(self, trainer):
    super(TextLoggerHook, self).METHOD_NAME(trainer)
    if self.out_dir is None:
        self.out_dir = trainer.work_dir
    if not osp.exists(self.out_dir) and is_master():
        os.makedirs(self.out_dir)
    trainer.logger.info('Text logs will be saved to {}'.format(
        self.out_dir))
    self.start_iter = trainer.iter
    self.json_log_path = osp.join(self.out_dir,
                                  '{}.log.json'.format(trainer.timestamp))
    if hasattr(trainer, 'meta') and trainer.meta is not None:
        self._dump_log(trainer.meta)