Add logging levels for unit tests

Add logging levels for the mock environment for unit tests. Values
map to a string name instead of an integer like in the normal
environment.
This commit is contained in:
Robin Malley 2021-09-12 16:24:43 +00:00
parent c00903505b
commit d5a3197262
1 changed files with 9 additions and 0 deletions

View File

@ -106,6 +106,15 @@ local smr_mock_env = {
end), end),
http_response_cookie = spy.new(function(req,name,value) req.cookies = {[name] = value} end), http_response_cookie = spy.new(function(req,name,value) req.cookies = {[name] = value} end),
log = spy.new(function(priority, message) --[[print(string.format("[LOG %q]: %s",priority,message))]] end), log = spy.new(function(priority, message) --[[print(string.format("[LOG %q]: %s",priority,message))]] end),
--Logging:
LOG_DEBUG = "debug",
LOG_INFO = "info",
LOG_NOTICE = "notice",
LOG_WARNING = "warning",
LOG_ERR = "error",
LOG_CRIT = "critical",
LOG_ALERT = "alert",
LOG_EMERG = "emergency",
sha3 = spy.new(function(message) return "digest" end), sha3 = spy.new(function(message) return "digest" end),
} }