MCPcopy Create free account
hub / github.com/StackStorm/st2 / process_attribute_value

Function process_attribute_value

st2common/st2common/logging/formatters.py:73–95  ·  view source on GitHub ↗

Format and process the extra attribute value.

(key, value)

Source from the content-addressed store, hash-verified

71
72
73def process_attribute_value(key, value):
74 """
75 Format and process the extra attribute value.
76 """
77 if not cfg.CONF.log.mask_secrets:
78 return value
79
80 blacklisted_attribute_names = (
81 MASKED_ATTRIBUTES_BLACKLIST + cfg.CONF.log.mask_secrets_blacklist
82 )
83
84 # NOTE: This can be expensive when processing large dicts or objects
85 if isinstance(value, SIMPLE_TYPES):
86 if key in blacklisted_attribute_names:
87 value = MASKED_ATTRIBUTE_VALUE
88 elif isinstance(value, dict):
89 # Note: We don't want to modify the original value
90 value = fast_deepcopy_dict(value)
91
92 for dict_key, dict_value in six.iteritems(value):
93 value[dict_key] = process_attribute_value(key=dict_key, value=dict_value)
94
95 return value
96
97
98class ObjectJSONEncoder(json.JSONEncoder):

Callers 1

Calls 1

fast_deepcopy_dictFunction · 0.90

Tested by

no test coverage detected