For reference, the default [level] tag:
https://github.com/oUF-wow/oUF/blob/....lua#L221-L232
Lua Code:
['level'] = [[function(u)
local l = UnitLevel(u)
if(UnitIsWildBattlePet(u) or UnitIsBattlePetCompanion(u)) then
l = UnitBattlePetLevel(u)
end
if(l > 0) then
return l
else
return '??'
end
end]],