Skip to content

(Logger):getAncestry

Used internally to get all hierarchy of the current Logger. The array is in "reverse", with the first logger at the first position, and the next one is the one the current Logger was (Logger):extended from.

This is useful if you're writing your own log sink.

Synopsis

chain = Logger:getAncestry()

Parameters

None.

Returns

ancestryData table

An array of the logger's ancestry information. ancestryData[1] will be the upmost root, ancestryData[#ancestryData] will be the Logger that called the function.

Each entry in the table, is a table with the two fields name string and colorDef color

Examples

local ancestryData = Logger:getAncestry()
local prefixParts = { }
for _, node in ipairs(ancestryData) do
  table.insert(prefixParts, node.name)
end
print(table.concat(prefixParts, ":"))

See Also