diff --git a/logging.lua b/logging.lua index 7c12b5c..56b7c0e 100644 --- a/logging.lua +++ b/logging.lua @@ -104,10 +104,12 @@ function RecursionSentinel.remove(knownTables, value) knownTables[value] = nil end -local function cloneNonRecursive(value, sentinels) - if type(value) == "table" then +local function cloneNonRecursive(inValue, sentinels) + if type(inValue) == "table" then + local wrapLogPlain = LogPlain.is(inValue) and function(v) return LogPlain.of(v, inValue.deep) end or function(v) return v end + local value = LogPlain.getValue(inValue) if RecursionSentinel.isKnown(sentinels, value) then - return RecursionSentinel.getSentinel(sentinels, value) + return wrapLogPlain(RecursionSentinel.getSentinel(sentinels, value)) end local sentinel = RecursionSentinel.getSentinel(sentinels, value) @@ -121,9 +123,9 @@ local function cloneNonRecursive(value, sentinels) RecursionSentinel.remove(sentinels, sentinel.table) sentinel.value = clone - return sentinel.value + return wrapLogPlain(sentinel.value) else - return value + return inValue end end @@ -137,6 +139,7 @@ local function _simpleStringify(inValue, builder, ignoreGlobals, skipFunctions, local isPlain = plain or LogPlain.is(inValue) local isDeep = plain or LogPlain.isDeep(inValue) if type(value) == "table" then + table.insert(builder, tostring(getmetatable(inValue))) if not isPlain then table.insert(builder, "<") end