From b51856c3de6ead74492c9f1fd27cac1e6e949369 Mon Sep 17 00:00:00 2001 From: Nicholas Foreman Date: Thu, 21 Nov 2024 22:12:25 -0800 Subject: [PATCH] Allow for default level --- src/init.luau | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/init.luau b/src/init.luau index fa16146..64ff64c 100644 --- a/src/init.luau +++ b/src/init.luau @@ -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) @@ -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