This commit is contained in:
parent
eb295549fb
commit
4c328370c2
|
@ -177,7 +177,7 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
|
||||||
user_id = info.context.get('user_id')
|
user_id = info.context.get('user_id')
|
||||||
if not user_id:
|
if not user_id:
|
||||||
return {"error": "unauthorized"}
|
return {"error": "unauthorized"}
|
||||||
roles = info.context.get('roles')
|
roles = info.context.get('roles', [])
|
||||||
shout_input = shout_input or {}
|
shout_input = shout_input or {}
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
|
|
|
@ -16,10 +16,11 @@ secondary_colors = {
|
||||||
'asctime': {'DEBUG': 'cyan'},
|
'asctime': {'DEBUG': 'cyan'},
|
||||||
'process': {'DEBUG': 'purple'},
|
'process': {'DEBUG': 'purple'},
|
||||||
'module': {'DEBUG': 'light_black,bg_blue'},
|
'module': {'DEBUG': 'light_black,bg_blue'},
|
||||||
|
'funcName': {'DEBUG': 'light_white,bg_blue'}, # Add this line
|
||||||
}
|
}
|
||||||
|
|
||||||
# Define the log format string
|
# Define the log format string
|
||||||
fmt_string = '%(log_color)s%(levelname)s: %(log_color)s[%(module)s]%(reset)s %(white)s%(message)s'
|
fmt_string = '%(log_color)s%(levelname)s: %(log_color)s[%(module)s.%(funcName)s]%(reset)s %(white)s%(message)s'
|
||||||
|
|
||||||
# Define formatting configuration
|
# Define formatting configuration
|
||||||
fmt_config = {
|
fmt_config = {
|
||||||
|
@ -29,7 +30,6 @@ fmt_config = {
|
||||||
'reset': True,
|
'reset': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MultilineColoredFormatter(colorlog.ColoredFormatter):
|
class MultilineColoredFormatter(colorlog.ColoredFormatter):
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
# Check if the message is multiline
|
# Check if the message is multiline
|
||||||
|
@ -46,7 +46,6 @@ class MultilineColoredFormatter(colorlog.ColoredFormatter):
|
||||||
# If not multiline or no message, use the default formatting
|
# If not multiline or no message, use the default formatting
|
||||||
return super().format(record)
|
return super().format(record)
|
||||||
|
|
||||||
|
|
||||||
# Create a MultilineColoredFormatter object for colorized logging
|
# Create a MultilineColoredFormatter object for colorized logging
|
||||||
formatter = MultilineColoredFormatter(fmt_string, **fmt_config)
|
formatter = MultilineColoredFormatter(fmt_string, **fmt_config)
|
||||||
|
|
||||||
|
@ -54,7 +53,6 @@ formatter = MultilineColoredFormatter(fmt_string, **fmt_config)
|
||||||
stream = logging.StreamHandler()
|
stream = logging.StreamHandler()
|
||||||
stream.setFormatter(formatter)
|
stream.setFormatter(formatter)
|
||||||
|
|
||||||
|
|
||||||
def get_colorful_logger(name='main'):
|
def get_colorful_logger(name='main'):
|
||||||
# Create and configure the logger
|
# Create and configure the logger
|
||||||
logger = logging.getLogger(name)
|
logger = logging.getLogger(name)
|
||||||
|
@ -63,7 +61,6 @@ def get_colorful_logger(name='main'):
|
||||||
|
|
||||||
return logger
|
return logger
|
||||||
|
|
||||||
|
|
||||||
# Set up the root logger with the same formatting
|
# Set up the root logger with the same formatting
|
||||||
root_logger = logging.getLogger()
|
root_logger = logging.getLogger()
|
||||||
root_logger.setLevel(logging.DEBUG)
|
root_logger.setLevel(logging.DEBUG)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user