mirror of https://github.com/pwndbg/pwndbg.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
602 B
Python
25 lines
602 B
Python
"""
|
|
Logging.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
import pwndbg.color
|
|
|
|
|
|
class ColorFormatter(logging.Formatter):
|
|
log_funcs = {
|
|
logging.DEBUG: pwndbg.color.message.debug,
|
|
logging.INFO: pwndbg.color.message.info,
|
|
logging.WARNING: pwndbg.color.message.warn,
|
|
logging.ERROR: pwndbg.color.message.error,
|
|
logging.CRITICAL: pwndbg.color.message.error,
|
|
}
|
|
|
|
def format(self, record):
|
|
log_func = self.log_funcs.get(record.levelno)
|
|
formatter = logging.Formatter(log_func("%(message)s"))
|
|
return formatter.format(record)
|