LibLog is a structured logging library for World of Warcraft addons.
MyAddon:LogInfo("My current health is {health}, and I have {mana} mana", UnitHealth("player"), UnitPower("player"))
-- MyAddon: My current health is 50, and I have 100 mana
Out of the box, LibLog prints readable messages to the chat window, and that's all most users will ever see. Behind the scenes, each log also records its values as named properties, which other addons (called sinks) can capture and inspect.
Features
- Simple logging API with well-known levels: trace, debug, info, warning, error, and fatal.
- Configurable minimum log level per addon.
- Structured logging using Message Templates.
- Custom sinks to capture and process logs in real-time.
- Works out of the box with AceAddon-3.0 addons and modules.
Why structured logging?
Traditional logging writes plain text:
print(UnitName("player") .. ": UNIT_SPELLCAST_SUCCEEDED " .. spellName)
Thrall: UNIT_SPELLCAST_SUCCEEDED Bloodlust
Khadgar: UNIT_SPELLCAST_SUCCEEDED Blink
Thrall: UNIT_SPELLCAST_FAILED Lightning Bolt
Khadgar: UNIT_SPELLCAST_SUCCEEDED Fire Blast
This is easy to read, but hard to analyze. Who cast Bloodlust? Whose casts failed? Who cast the most spells? Answering that means parsing text, which only gets harder in a 20-player raid.
Structured logging keeps the values separate from the text. LibLog uses Message Templates, where each {placeholder}
in the message becomes a named property:
MyAddon:LogInfo("{name}: {eventName} {spellName}", UnitName("player"), event, spellName)
{
message = "Thrall: UNIT_SPELLCAST_SUCCEEDED Bloodlust",
properties = {
name = "Thrall",
eventName = "UNIT_SPELLCAST_SUCCEEDED",
spellName = "Bloodlust"
}
-- <other fields omitted>
}
A sink can now filter, group, or count logs by any of these properties.

