|Centralizing debug output||Jakob Kristoferitsch||8/20/12 7:42 AM|
as part of my GSoC project (developer dashboard), I thought about how
the way logging/debugging is done in SilverStripe could be changed. Ingo
summarized the current state of the framework code at
I think that direct output should be avoided, even for debug purposes.
All debug output should be passed through a central logging class instead.
A demonstration of that approach is my debug_rewrite branch (see
Instead of direct echos, all output in the Debug class is passed to a
SS_ZendLog instance. By default, this is logger has a DebugEchoWriter
attached, a Zend_Log_Writer_Abstract that then echos the information
directly onto the page. By calling Debug::replaceDefaultOutputWriter it
is possible to replace that output writer with any other
The rewritten code is designed to be used in combination with the
developer dashboard (<https://github.com/jakr/developer_dashboard/>). If
that module is installed, all error output can be redirected to the
dashboard by adding two lines to _config.php:
$writers = DashboardLog::get_log_wrapper('DEBUG',
Of course, it is also possible to replace the writer with one of the
default Zend_Log writers (File, Mail, DB) or with a custom one.
Has anyone else thought about this? Are there better approaches?
P.S.: I'll only have limited access to the internet for the next month,
so my responses will be sporadic.