-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding utils to get logger for file name and set logging levels * adding logging calls to project/map_data for debugging * fix: fault topology merge was using incorrect lookups * adding logging to def history and m2l wrapper * fix: run map2model for user defined stratigraphic column * removing logger from this pr * fix: use fault id not Fault_{id} * adding more logging for config and mapdata * logging for m2m inputs * linting * fix: missing label in structurepoint thickness calculator * updating so tests pass * only run builds on master * remove Fault_ from table
- Loading branch information
1 parent
5ebc07b
commit e6aa3e9
Showing
13 changed files
with
279 additions
and
76 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 |
---|---|---|
|
@@ -10,4 +10,4 @@ beartype | |
gdal==3.8.4 | ||
hjson | ||
pytest | ||
scikit-learn | ||
scikit-learn |
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
|
||
import logging | ||
loggers = {} | ||
ch = logging.StreamHandler() | ||
formatter = logging.Formatter("%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d -- %(message)s") | ||
ch.setFormatter(formatter) | ||
ch.setLevel(logging.WARNING) | ||
from .project import Project | ||
from .version import __version__ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import logging | ||
import map2loop | ||
def get_levels(): | ||
"""dict for converting to logger levels from string | ||
Returns | ||
------- | ||
dict | ||
contains all strings with corresponding logging levels. | ||
""" | ||
return { | ||
"info": logging.INFO, | ||
"warning": logging.WARNING, | ||
"error": logging.ERROR, | ||
"debug": logging.DEBUG, | ||
} | ||
|
||
def getLogger(name:str): | ||
"""Get a logger object with a specific name | ||
Parameters | ||
---------- | ||
name : str | ||
name of the logger object | ||
Returns | ||
------- | ||
logging.Logger | ||
logger object | ||
""" | ||
if name in map2loop.loggers: | ||
return map2loop.loggers[name] | ||
logger = logging.getLogger(name) | ||
logger.addHandler(map2loop.ch) | ||
logger.propagate = False | ||
map2loop.loggers[name] = logger | ||
return logger | ||
logger = getLogger(__name__) | ||
def set_level(level:str): | ||
"""Set the level of the logging object | ||
Parameters | ||
---------- | ||
level : str | ||
level of the logging object | ||
""" | ||
levels = get_levels() | ||
level = levels.get(level, logging.WARNING) | ||
map2loop.ch.setLevel(level) | ||
|
||
for name in map2loop.loggers: | ||
logger = logging.getLogger(name) | ||
logger.setLevel(level) | ||
logger.info(f"Logging level set to {level}") |
Oops, something went wrong.