Skip to content

Commit b5a660e

Browse files
author
cloether
committed
updated dev scripts
1 parent bb3c74c commit b5a660e

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed

scripts/changelog.sh

100644100755
File mode changed.

scripts/checklic.py

100644100755
File mode changed.

scripts/rpm_install.sh

100644100755
File mode changed.

scripts/winbuild.py

100644100755
File mode changed.

skeleton/log.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,34 @@
4949
_LOGGING_JSON_SORT_KEYS = 1
5050
_LOGGING_JSON_INDENT = 1
5151

52+
# https://github.com/awslabs/aws-lambda-powertools-python/blob/develop/aws_lambda_powertools/logging/formatter.py
53+
RESERVED_LOG_ATTRS = (
54+
"name",
55+
"msg",
56+
"args",
57+
"level",
58+
"levelname",
59+
"levelno",
60+
"pathname",
61+
"filename",
62+
"module",
63+
"exc_info",
64+
"exc_text",
65+
"stack_info",
66+
"lineno",
67+
"funcName",
68+
"created",
69+
"msecs",
70+
"relativeCreated",
71+
"thread",
72+
"threadName",
73+
"processName",
74+
"process",
75+
"asctime",
76+
"location",
77+
"timestamp",
78+
)
79+
5280

5381
# private
5482

@@ -387,3 +415,46 @@ def format(self, record):
387415

388416
def __getattr__(self, attr):
389417
return getattr(self.base_formatter, attr)
418+
419+
420+
class SuppressFilter(logging.Filter):
421+
"""Suppress Filter.
422+
"""
423+
424+
# noinspection PyMissingConstructor
425+
def __init__(self, logger):
426+
self.logger = logger
427+
428+
def filter(self, record): # noqa: A003
429+
"""Suppress Log Records from registered logger.
430+
431+
It rejects log records from registered logger
432+
e.g. a child logger otherwise it honours log
433+
propagation from any log record created by loggers
434+
who don't have a handler.
435+
436+
Args:
437+
record (logging.LogRecord): Log Record.
438+
439+
Returns:
440+
bool: True if record should be filtered, otherwise False.
441+
"""
442+
logger = record.name
443+
return self.logger not in logger
444+
445+
446+
class SyslogBOMFormatter(logging.Formatter):
447+
"""Syslog BOM Formatter
448+
"""
449+
450+
def format(self, record):
451+
"""Format Log Record.
452+
453+
Args:
454+
record (logging.LogRecord): Log Record.
455+
456+
Returns:
457+
str: Formatted Log Record.
458+
"""
459+
result = super(SyslogBOMFormatter, self).format(record)
460+
return "ufeff{0}".format(result)

0 commit comments

Comments
 (0)