Skip to content

Commit

Permalink
Release version 0.0.0.dev38
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Sep 25, 2024
1 parent 24c477e commit b0631b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev37"
version = "0.0.0.dev38"
name = "LoggerMan"
dependencies = [
"MDit == 0.0.0.dev12",
Expand Down
17 changes: 13 additions & 4 deletions src/loggerman/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys as _sys
import traceback as _traceback
from functools import wraps as _wraps
from pathlib import Path as _Path

import actionman as _actionman
import mdit as _mdit
Expand Down Expand Up @@ -708,11 +709,19 @@ def _get_github_annotation_type(level: LogLevel) -> Literal["notice", "warning",
def _get_caller_name(stack_up: int = 0) -> str:
stack = _inspect.stack()
# The caller is the second element in the stack list
caller_frame = stack[2 + stack_up]
module = _inspect.getmodule(caller_frame[0])
module_name = module.__name__ if module else "<module>"
caller_frame = stack[stack_up + 1]
caller_module = _inspect.getmodule(caller_frame.frame)
if caller_module:
caller_module_name = caller_module.__name__
else:
caller_filename = caller_frame.filename
caller_filepath = _Path(caller_filename)
caller_module_name = caller_filepath.stem
# Get the function or method name
func_name = caller_frame.function
# Combine them to get a fully qualified name
fully_qualified_name = f"{module_name}.{func_name}"
if func_name == "<module>":
fully_qualified_name = f"{caller_module_name}:{caller_frame.lineno}"
else:
fully_qualified_name = f"{caller_module_name}.{func_name}"
return fully_qualified_name

0 comments on commit b0631b4

Please sign in to comment.