Skip to content

Commit

Permalink
some small fixes to jl_log (#25335)
Browse files Browse the repository at this point in the history
- synchronize printing format of fallback logging
- make new logging work under `--lisp`
  • Loading branch information
JeffBezanson authored Dec 31, 2017
1 parent 7fc268f commit 56b59ec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ end

# Log a message. Called from the julia C code; kwargs is in the format
# Any[key1,val1, ...] for simplicity in construction on the C side.
function logmsg_thunk(level, message, _module, group, id, file, line, kwargs)
function logmsg_shim(level, message, _module, group, id, file, line, kwargs)
real_kws = Any[(kwargs[i],kwargs[i+1]) for i in 1:2:length(kwargs)]
@logmsg(convert(LogLevel, level), message,
_module=_module, _id=id, _group=group,
Expand Down
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ JL_DLLEXPORT jl_array_t *jl_array_cconvert_cstring(jl_array_t *a);
JL_DLLEXPORT void jl_depwarn_partial_indexing(size_t n);
void jl_depwarn(const char *msg, jl_value_t *sym);

// Log `msg` to the current logger by calling CoreLogging.logmsg_thunk() on the
// Log `msg` to the current logger by calling CoreLogging.logmsg_shim() on the
// julia side. If any of module, group, id, file or line are NULL, these will
// be passed to the julia side as `nothing`. If `kwargs` is NULL an empty set
// of keyword arguments will be passed.
Expand Down
26 changes: 13 additions & 13 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,32 +1039,32 @@ void jl_log(int level, jl_value_t *module, jl_value_t *group, jl_value_t *id,
if (!logmsg_func && jl_base_module) {
jl_value_t *corelogging = jl_get_global(jl_base_module, jl_symbol("CoreLogging"));
if (corelogging && jl_is_module(corelogging)) {
logmsg_func = jl_get_global((jl_module_t*)corelogging, jl_symbol("logmsg_thunk"));
logmsg_func = jl_get_global((jl_module_t*)corelogging, jl_symbol("logmsg_shim"));
}
}
if (!logmsg_func) {
ios_t str_;
ios_mem(&str_, 300);
uv_stream_t* str = (uv_stream_t*)&str_;
if (jl_is_string(msg)) {
jl_uv_puts(str, jl_string_data(msg), jl_string_len(msg));
}
else if (jl_is_symbol(msg)) {
jl_printf(str, "%s", jl_symbol_name((jl_sym_t*)msg));
}
jl_printf(str, "\n@ ");
if (jl_is_string(file)) {
jl_uv_puts(str, jl_string_data(file), jl_string_len(file));
}
else {
jl_static_show(str, file);
else if (jl_is_symbol(file)) {
jl_printf(str, "%s", jl_symbol_name((jl_sym_t*)file));
}
jl_printf(str, ":");
jl_static_show(str, line);
jl_printf(str, " - ");
if (jl_is_string(msg)) {
jl_uv_puts(str, jl_string_data(msg), jl_string_len(msg));
}
else {
jl_static_show(str, msg);
}
jl_safe_printf("%s [Fallback logging]: %.*s\n",
level < JL_LOGLEVEL_INFO ? "DEBUG" :
level < JL_LOGLEVEL_WARN ? "INFO" :
level < JL_LOGLEVEL_ERROR ? "WARNING" : "ERROR",
level < JL_LOGLEVEL_INFO ? "Debug" :
level < JL_LOGLEVEL_WARN ? "Info" :
level < JL_LOGLEVEL_ERROR ? "Warning" : "Error",
(int)str_.size, str_.buf);
ios_close(&str_);
return;
Expand Down
1 change: 1 addition & 0 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ int wmain(int argc, wchar_t *argv[], wchar_t *envp[])
jl_parse_opts(&argc, (char***)&argv);
julia_init(jl_options.image_file_specified ? JL_IMAGE_CWD : JL_IMAGE_JULIA_HOME);
if (lisp_prompt) {
jl_get_ptls_states()->world_age = jl_get_world_counter();
jl_lisp_prompt();
return 0;
}
Expand Down

2 comments on commit 56b59ec

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.