From d5a3197262e8352fa4443a70c7d40930c4ebd80e Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Sun, 12 Sep 2021 16:24:43 +0000 Subject: [PATCH] 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. --- spec/env_mock.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/env_mock.lua b/spec/env_mock.lua index 3777226..7bb6f87 100644 --- a/spec/env_mock.lua +++ b/spec/env_mock.lua @@ -106,6 +106,15 @@ local smr_mock_env = { 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), + --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), }