-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explain what this PR does. --------- Signed-off-by: Gulshan Bhatia <[email protected]> Signed-off-by: Gulshan Bhatia <[email protected]> Co-authored-by: Gulshan Bhatia <[email protected]>
- Loading branch information
Showing
14 changed files
with
279 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import structlog | ||
from structlog import processors, stdlib | ||
|
||
|
||
def configure_logger(): | ||
"""Configure struct logger for the UDFs.""" | ||
structlog.configure( | ||
processors=[ | ||
stdlib.filter_by_level, | ||
stdlib.add_log_level, | ||
stdlib.PositionalArgumentsFormatter(), | ||
processors.TimeStamper(fmt="iso"), | ||
processors.StackInfoRenderer(), | ||
# processors.format_exc_info, | ||
processors.UnicodeDecoder(), | ||
processors.KeyValueRenderer(key_order=["uuid", "event"]), | ||
stdlib.ProcessorFormatter.wrap_for_formatter, | ||
], | ||
logger_factory=stdlib.LoggerFactory(), | ||
wrapper_class=stdlib.BoundLogger, | ||
cache_logger_on_first_use=True, | ||
) | ||
return structlog.getLogger(__name__) | ||
|
||
|
||
def log_data_payload_values(log, data_payload): | ||
return log.bind( | ||
uuid=data_payload["uuid"], | ||
config_id=data_payload["config_id"], | ||
pipeline_id=data_payload.get("pipeline_id", "default"), | ||
metadata=data_payload.get("metadata", {}), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.