Skip to content

Commit

Permalink
Merge branch 'master' into shyamsai/noInheritLogging
Browse files Browse the repository at this point in the history
  • Loading branch information
sss04 authored Aug 6, 2024
2 parents 035f9bf + 12d8113 commit c6cf752
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _log_error_base(self, class_name: str, method_name: str, e: Exception):
json.dumps(self._get_payload(class_name, method_name, None, None, e))
)

def log_verb(method_name: Optional[str] = None):
def log_verb(method_name: Optional[str] = None, feature_name: Optional[str] = None):
def get_wrapper(func):
@functools.wraps(func)
def log_decorator_wrapper(self, *args, **kwargs):
Expand All @@ -198,7 +198,7 @@ def log_decorator_wrapper(self, *args, **kwargs):
method_name if method_name else func.__name__,
SynapseMLLogger.get_column_number(args, kwargs),
execution_time,
None,
feature_name,
)
return result
except Exception as e:
Expand Down
5 changes: 5 additions & 0 deletions core/src/test/python/synapsemltest/core/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def fit(self, df):
@SynapseMLLogger.log_verb()
def test_throw(self):
raise Exception("test exception")

@SynapseMLLogger.log_verb(feature_name="test_logging")
def test_feature_name(self):
return 0

class NoInheritTransformer():
def __init__(self):
Expand Down Expand Up @@ -59,6 +63,7 @@ def test_logging_smoke(self):
t.test_throw()
except Exception as e:
assert f"{e}" == "test exception"
t.test_feature_name()

def test_logging_smoke_no_inheritance(self):
t = NoInheritTransformer()
Expand Down

0 comments on commit c6cf752

Please sign in to comment.