Skip to content

Commit 29e44be

Browse files
authored
Merge pull request #18 from NACLab/dev
Dev
2 parents a11d96a + affb0ba commit 29e44be

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

ngcsimlib/context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def make_components(self, path_to_components_file, custom_file_dir=None):
327327
this directory is named `custom` if the save_to_json method is
328328
used. (Default: None)
329329
"""
330+
made_components = []
330331
with open(path_to_components_file, 'r') as file:
331332
componentsConfig = json.load(file)
332333

@@ -349,6 +350,9 @@ def make_components(self, path_to_components_file, custom_file_dir=None):
349350
if check_attributes(obj, ["load"]):
350351
obj.load(custom_file_dir)
351352

353+
made_components.append(obj)
354+
return made_components
355+
352356
def make_ops(self, path_to_ops_file):
353357
"""
354358
Loads a collection of ops from a json file. Follow `ops.schema`
@@ -501,3 +505,4 @@ def make_modules(self):
501505
_modules.append({"absolute_path": key, "attributes": value["attributes"]})
502506

503507
return _modules
508+

ngcsimlib/logger.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def init_logging():
6969
loggingConfig = {"logging_file": None,
7070
"logging_level": logging.WARNING,
7171
"hide_console": False,
72-
"custom_levels": {"ANALYSIS", 25}}
72+
"custom_levels": {"ANALYSIS": 25}}
7373

7474
if loggingConfig.get("custom_levels", None) is not None:
7575
for level_name, level_num in loggingConfig.get("custom_levels", {}).items():
@@ -163,6 +163,23 @@ def debug(msg):
163163

164164
@_concatArgs
165165
def custom_log(msg, logging_level=None):
166+
"""
167+
Logs to a user defined logging level. This will only work for user defined
168+
levels if a builtin logging level is desired please use on of the builtin
169+
logging methods found in this file. To defined logging levels add them to the
170+
configuration file of your project. To add levels here add the map of
171+
`logging_levels` to the top level logging object and have the key be the new
172+
logging level name, and the value be the numerical logging value. To see all
173+
build in logging levels look at the builtin python logger package.
174+
175+
176+
This is decorated to have the same functionality of python's print argument concatenation
177+
178+
Args:
179+
msg: The message to log
180+
181+
logging_level: The user defined logging level.
182+
"""
166183
if isinstance(logging_level, str):
167184
logging_level = logging_level.upper()
168185

0 commit comments

Comments
 (0)