]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
automatically prepend filename to debug output
authorEvan Prodromou <evan@prodromou.name>
Thu, 5 Jun 2008 02:40:35 +0000 (22:40 -0400)
committerEvan Prodromou <evan@prodromou.name>
Thu, 5 Jun 2008 02:40:35 +0000 (22:40 -0400)
darcs-hash:20080605024035-84dde-bc3abc4329f3181cffd26e83d37968ee6a02a26e.gz

actions/userauthorization.php
lib/common.php
lib/util.php

index 29a0c9d6acdaa149462941e2442e238f194fcede..fd4ed5b08fc326076b1cd482d8b071a2557e6e17 100644 (file)
@@ -326,13 +326,21 @@ class UserauthorizationAction extends Action {
        function validate_request(&$req) {
                # OAuth stuff -- have to copy from OAuth.php since they're
                # all private methods, and there's no user-authentication method
+               common_debug('checking version', __FILE__);
                $this->check_version($req);
+               common_debug('getting datastore', __FILE__);            
                $datastore = omb_oauth_datastore();
+               common_debug('getting consumer', __FILE__);
                $consumer = $this->get_consumer($datastore, $req);
+               common_debug('getting token', __FILE__);                
                $token = $this->get_token($datastore, $req, $consumer);
+               common_debug('checking timestamp', __FILE__);
                $this->check_timestamp($req);
+               common_debug('checking nonce', __FILE__);               
                $this->check_nonce($datastore, $req, $consumer, $token);
+               common_debug('checking signature', __FILE__);
                $this->check_signature($req, $consumer, $token);
+               common_debug('checking signature', __FILE__);           
                $this->validate_omb($req);
                return true;
        }
index 19b0e4b643d4a0676a4ee0e827c3d3453322a757..b2c0a7b4645abd72415303735aaa2bfd34f2a22a 100644 (file)
@@ -35,6 +35,7 @@ require_once('DB/DataObject/Cast.php'); # for dates
 $config =
   array('site' =>
                array('name' => 'Just another Laconica microblog',
+                         'appname' => 'laconica', # for syslog
                          'server' => 'localhost',
                          'path' => '/',
                          'fancy' => false),
index a222f85f6542e74d6f3e7070961357e659323c9a..7171211da3dfa3983c21b9c1ed9ec2a6e53f44cd 100644 (file)
@@ -575,19 +575,22 @@ function _t($str) {
 function common_ensure_syslog() {
        static $initialized = false;
        if (!$initialized) {
+               global $config;
                define_syslog_variables();
-               openlog("laconica", 0, LOG_USER);
+               openlog($config['site']['appname'], 0, LOG_USER);
                $initialized = true;
        }
 }
 
-function common_log($priority, $msg) {
+function common_log($priority, $msg, $filename=NULL) {
        common_ensure_syslog();
-       syslog($priority, $msg);
+       if ($filename) {
+               syslog($priority, basename($filename).' - '.$msg);
+       }
 }
 
-function common_debug($msg) {
-       common_log(LOG_DEBUG, $msg);
+function common_debug($msg, $filename=NULL) {
+       common_log(LOG_DEBUG, $msg, $filename);
 }
 
 function common_valid_http_url($url) {