-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log to stdout. Minimal logging for create case and workflow job, ordi…
…nary logging in forward job. (#54) * Log to stdout. Minimal logging for create case and workflow job * Remove unused var
- Loading branch information
Showing
8 changed files
with
71 additions
and
19 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
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,36 @@ | ||
import logging | ||
import sys | ||
import os | ||
import time | ||
|
||
# def getLogger(module_name="subscript"): | ||
def get_uploader_logger(): | ||
# pylint: disable=invalid-name | ||
"""Provides a unified logger for fmu-sumo-uploader. | ||
Code is copied from | ||
https://github.com/equinor/subscript/blob/main/src/subscript/__init__.py | ||
Logging output is split by logging levels (split between WARNING and ERROR) | ||
to stdout and stderr, each log occurs in only one of the streams. | ||
Returns: | ||
A logger object | ||
""" | ||
logger = logging.getLogger("fmu.sumo.uploader") | ||
logger.propagate = False # Avoids duplicate logging | ||
|
||
if not len(logger.handlers): | ||
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(name)s:%(message)s") | ||
|
||
stdout_handler = logging.StreamHandler(sys.stdout) | ||
stdout_handler.addFilter(lambda record: record.levelno < logging.ERROR) | ||
stdout_handler.setFormatter(formatter) | ||
logger.addHandler(stdout_handler) | ||
|
||
stderr_handler = logging.StreamHandler(sys.stderr) | ||
stderr_handler.addFilter(lambda record: record.levelno >= logging.ERROR) | ||
stderr_handler.setFormatter(formatter) | ||
logger.addHandler(stderr_handler) | ||
|
||
return logger |
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
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