aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-05 20:39:19 -0800
committerfriendica <info@friendica.com>2013-02-05 20:39:19 -0800
commit6a23ac9217ab5b743cbb14243651ee40cfcc3c5a (patch)
treef1efc274b8a7a8feb7d27edd556b6483b1f13da7 /include/text.php
parent2a6abaf9d54f7345e04db8b3fb5fe96eaa2a5c1d (diff)
downloadvolse-hubzilla-6a23ac9217ab5b743cbb14243651ee40cfcc3c5a.tar.gz
volse-hubzilla-6a23ac9217ab5b743cbb14243651ee40cfcc3c5a.tar.bz2
volse-hubzilla-6a23ac9217ab5b743cbb14243651ee40cfcc3c5a.zip
added 'dlogger()' which is intended as a low noise personal logger() facility for developers. See the source.
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index 996f769dd..8cb3a930a 100644
--- a/include/text.php
+++ b/include/text.php
@@ -463,6 +463,34 @@ function logger($msg,$level = 0) {
}}
+// This is a special logging facility for developers. It allows one to target specific things to trace/debug
+// and is identical to logger() with the exception of the log filename. This allows one to isolate specific
+// calls while allowing logger() to paint a bigger picture of overall activity and capture more detail.
+// If you find dlogger() calls in checked in code, you are free to remove them - so as to provide a noise-free
+// development environment which responds to events you are targetting personally.
+
+if(! function_exists('dlogger')) {
+function dlogger($msg,$level = 0) {
+ // turn off logger in install mode
+ global $a;
+ global $db;
+
+ if(($a->module == 'install') || (! ($db && $db->connected))) return;
+
+ $debugging = get_config('system','debugging');
+ $loglevel = intval(get_config('system','loglevel'));
+ $logfile = get_config('system','dlogfile');
+
+ if((! $debugging) || (! $logfile) || ($level > $loglevel))
+ return;
+
+ @file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $msg . "\n", FILE_APPEND);
+ return;
+}}
+
+
+
+
if(! function_exists('activity_match')) {
function activity_match($haystack,$needle) {
if(($haystack === $needle) || ((basename($needle) === $haystack) && strstr($needle,NAMESPACE_ACTIVITY_SCHEMA)))