Skip to content

Commit

Permalink
Correct module for @Logged messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
orenbenkiki committed Apr 8, 2024
1 parent 5bcf4f2 commit 1e637ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/v0.1.0/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-08T15:21:56","documenter_version":"1.3.0"}}
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-08T16:03:18","documenter_version":"1.3.0"}}
20 changes: 14 additions & 6 deletions src/generic_logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ macro logged(definition)
outer_definition[:body] = Expr(
:call,
:(GenericLogging.logged_wrapper(
$function_module,
$full_name,
$arg_names,
$has_result,
Expand All @@ -93,6 +94,7 @@ macro logged(definition)
outer_definition[:body] = Expr(
:call,
:(Daf.GenericLogging.logged_wrapper(
$function_module,
$full_name,
$arg_names,
$has_result,
Expand All @@ -114,19 +116,25 @@ function parse_arg(arg::Expr)::AbstractString
return parse_arg(arg.args[1])
end

function logged_wrapper(name::AbstractString, arg_names::AbstractStringVector, has_result::Bool, inner_function)
return (args...; kwargs...) -> (@debug "call: $(name))() {";
function logged_wrapper(
_module::Module,
name::AbstractString,
arg_names::AbstractStringVector,
has_result::Bool,
inner_function,
)
return (args...; kwargs...) -> (@debug "$(name) {" _module = _module;
for (arg_name, value) in zip(arg_names, args)
@debug "$(arg_name): $(depict(value))"
@debug "- $(arg_name): $(depict(value))" _module = _module
end;
for (name, value) in kwargs
@debug "$(name): $(depict(value))"
@debug "- $(name): $(depict(value))" _module = _module
end;
result = inner_function(args...; kwargs...);
if has_result
@debug "done: $(name) return: $(depict(result)) }"
@debug "$(name) return: $(depict(result)) }" _module = _module
else
@debug "done: $(name) }"
@debug "$(name) return }" _module = _module
end;
result) # only seems untested
end
Expand Down

0 comments on commit 1e637ff

Please sign in to comment.