File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 10
10
11
11
LOG_FORMAT = f"%(asctime)s.%(msecs)03d %(ls_level)5s --- [%(ls_thread){ MAX_THREAD_NAME_LEN } s] %(ls_name)-{ MAX_NAME_LEN } s : %(message)s"
12
12
LOG_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S"
13
+ LOG_INPUT_FORMAT = "%(input_type)s(%(input)s, headers=%(request_headers)s)"
14
+ LOG_OUTPUT_FORMAT = "%(output_type)s(%(output)s, headers=%(response_headers)s)"
15
+ LOG_CONTEXT_FORMAT = "%(account_id)s/%(region)s"
13
16
14
17
CUSTOM_LEVEL_NAMES = {
15
18
50 : "FATAL" ,
@@ -106,17 +109,16 @@ def compress_logger_name(name: str, length: int) -> str:
106
109
107
110
108
111
class TraceLoggingFormatter (logging .Formatter ):
109
- aws_trace_log_format = (
110
- LOG_FORMAT + "; %(account_id)s/%(region)s; "
111
- "%(input_type)s(%(input)s, headers=%(request_headers)s); "
112
- "%(output_type)s(%(output)s, headers=%(response_headers)s)"
113
- )
112
+ aws_trace_log_format = "; " .join ([LOG_FORMAT , LOG_INPUT_FORMAT , LOG_OUTPUT_FORMAT ])
114
113
115
114
def __init__ (self ):
116
115
super ().__init__ (fmt = self .aws_trace_log_format , datefmt = LOG_DATE_FORMAT )
117
116
118
117
119
118
class AwsTraceLoggingFormatter (TraceLoggingFormatter ):
119
+ aws_trace_log_format = "; " .join (
120
+ [LOG_FORMAT , LOG_CONTEXT_FORMAT , LOG_INPUT_FORMAT , LOG_OUTPUT_FORMAT ]
121
+ )
120
122
bytes_length_display_threshold = 512
121
123
122
124
def __init__ (self ):
You can’t perform that action at this time.
0 commit comments