26 lines
618 B
Python
26 lines
618 B
Python
|
# -------------------------------
|
||
|
# Difficult Rocket
|
||
|
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
||
|
# All rights reserved
|
||
|
# -------------------------------
|
||
|
|
||
|
import time
|
||
|
|
||
|
from lib_not_dr.types.options import Options
|
||
|
|
||
|
from .types import LogMessage
|
||
|
|
||
|
|
||
|
class BaseFormatter(Options):
|
||
|
name = 'BaseFormatter'
|
||
|
|
||
|
def format(self, message: LogMessage) -> str:
|
||
|
raise NotImplementedError(f'{self.__class__.__name__}.format is not implemented')
|
||
|
|
||
|
|
||
|
class TimeFormatter(BaseFormatter):
|
||
|
name = 'TimeFormatter'
|
||
|
|
||
|
def format(self, message: LogMessage) -> str:
|
||
|
return f'[{message.log_time}]'
|