Skip to content

Commit

Permalink
Allow for default level
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasforeman authored Nov 22, 2024
1 parent 6a5629c commit b51856c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Logr._defaultLevel = "None"
local tNew = t.tuple(t.string, t.optional(t.string))
function Logr.new(name: string, level: string?)
assert(tNew(name, level))

level = level or self._defaultLevel
assert(IsValidLogLevelName(level :: string))

local self = setmetatable({}, Logr)
Expand All @@ -41,7 +43,7 @@ function Logr.new(name: string, level: string?)
end

self.Name = name
self._logLevel = (level or self._defaultLevel) :: string
self._logLevel = level :: string
self._logId = logLevelToId[self._logLevel] :: number

return self
Expand Down

0 comments on commit b51856c

Please sign in to comment.