@@ -222,17 +222,17 @@ macro error(exs...) logmsg_code((@_sourceinfo)..., :Error, exs...) end
222222@eval @doc $ _logmsg_docs :(@error )
223223
224224_log_record_ids = Set {Symbol} ()
225- # Generate a unique, stable, short, human readable identifier for a logging
226- # statement. The idea here is to have a key against which log records can be
227- # filtered and otherwise manipulated. The key should uniquely identify the
228- # source location in the originating module, but should be stable across
229- # versions of the originating module, provided the log generating statement
230- # itself doesn't change.
231- function log_record_id (_module, level, message_ex )
225+ # Generate a unique, stable, short, somewhat human readable identifier for a
226+ # logging * statement*. The idea here is to have a key against which log events
227+ # can be filtered and otherwise manipulated. The key should uniquely identify
228+ # the source location in the originating module, but ideally should be stable
229+ # across versions of the originating module, provided the log generating
230+ # statement itself doesn't change.
231+ function log_record_id (_module, level, message, log_kws )
232232 modname = _module === nothing ? " " : join (fullname (_module), " _" )
233- # Use (1<<31) to fit well within an ( arbitriraly chosen) eight hex digits,
234- # as we increment h to resolve any collisions .
235- h = hash (string (modname, level, message_ex )) % ( 1 << 31 )
233+ # Use an arbitriraly chosen eight hex digits here. TODO : Figure out how to
234+ # make the id exactly the same on 32 and 64 bit systems .
235+ h = UInt32 ( hash (string (modname, level, message, log_kws )) & 0xFFFFFFFF )
236236 while true
237237 id = Symbol (modname, ' _' , string (h, base = 16 , pad = 8 ))
238238 # _log_record_ids is a registry of log record ids for use during
249249
250250# Generate code for logging macros
251251function logmsg_code (_module, file, line, level, message, exs... )
252- id = nothing
252+ id = Expr ( :quote , log_record_id (_module, level, message, exs))
253253 group = nothing
254254 kwargs = Any[]
255255 for ex in exs
@@ -289,8 +289,6 @@ function logmsg_code(_module, file, line, level, message, exs...)
289289 end
290290 end
291291
292- # Note that it may be necessary to set `id` and `group` manually during bootstrap
293- id = something (id, :(log_record_id (_module, level, $ exs)))
294292 if group == nothing
295293 group = if isdefined (Base, :basename ) && isa (file, String)
296294 # precompute if we can
0 commit comments