Added logs admin viewer.

Added CMS_SETUP.is_debug: BOOLEAN  (see cms.ini   site.debug setting)
This commit is contained in:
2016-02-19 00:03:15 +01:00
parent af137629e0
commit 77e2c28d18
12 changed files with 274 additions and 21 deletions

View File

@@ -170,6 +170,14 @@ feature -- Access
storage: CMS_STORAGE
-- Default persistence storage.
feature -- Settings
is_debug: BOOLEAN
-- Is debug mode enabled?
do
Result := setup.is_debug
end
feature {NONE} -- Access: request
request: WSF_REQUEST
@@ -261,6 +269,14 @@ feature -- Status Report
feature -- Logging
logs (a_category: detachable READABLE_STRING_8; a_lower: INTEGER; a_count: INTEGER): LIST [CMS_LOG]
-- List of recent logs from `a_lower' to `a_lower+a_count'.
-- If `a_category' is set, filter to return only associated logs.
-- If `a_count' <= 0 then, return all logs.
do
Result := storage.logs (a_category, a_lower, a_count)
end
log (a_category: READABLE_STRING_8; a_message: READABLE_STRING_8; a_level: INTEGER; a_link: detachable CMS_LINK)
local
l_log: CMS_LOG
@@ -674,11 +690,16 @@ feature -- Environment/ module
create {INI_CONFIG} Result.make_from_file (l_path)
end
end
if Result = Void and a_name /= Void then
-- Use sub config from default?
if attached {CONFIG_READER} module_configuration_by_name_in_location (a_module_name, a_dir, Void) as cfg then
if Result = Void then
if
a_name /= Void and then
attached {CONFIG_READER} module_configuration_by_name_in_location (a_module_name, a_dir, Void) as cfg
then
-- Use sub config from default.
Result := cfg.sub_config (a_name)
end
elseif Result.has_error then
log ("modules", "module configuration has error %"" + p.utf_8_name + "%"", {CMS_LOG}.level_error, Void)
end
end

View File

@@ -3,9 +3,12 @@ note
date: "$Date: 2015-02-13 14:54:27 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96620 $"
deferred class
class
CMS_MODULE_API
create
make
feature {NONE} -- Initialization
make (a_api: CMS_API)
@@ -67,6 +70,6 @@ feature -- Bridge to CMS API
end
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -992,6 +992,13 @@ feature -- Message
m.append (a_msg + "</li>")
end
add_debug_message (a_msg: READABLE_STRING_8)
do
if api.is_debug_enabled then
add_message (a_msg, "debug")
end
end
add_notice_message (a_msg: READABLE_STRING_8)
do
add_message (a_msg, "notice")