Changeset 1356

Show
Ignore:
Timestamp:
03/03/07 11:39:19 (2 years ago)
Author:
jm3
Message:

fixed logging to make it consistent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/bin/add-link.pl

    r1325 r1356  
    11#!/usr/local/bin/perl 
     2use strict; 
     3 
     4use DBD::mysql; 
    25use FeedMeLinks::Environment; 
    3 use strict; 
     6use LWP; 
     7use POSIX qw(strftime); 
     8 
    49# takes an email as stdin, "authenticates" the sender against  
    510# the FML db, uses the subject as the link name, the first  
     
    712# to the link 
    813 
    9 use LWP; 
    10 use DBD::mysql; 
    11  
    1214my $verbose = 0; 
     15my $now = strftime "%a %b %e %H:%M:%S %Y", localtime; 
    1316 
    1417# flags 
     
    7982 
    8083        if( ! $dbh ) { 
    81                 print LOG "can't connect to DB, fatal error\n"; 
     84                print LOG "$now [link-by-mail cant connect to DB]\n"; 
    8285                die( "can't connect to DB, fatal error\n" ); 
    8386        } 
     
    106109                my $linkID = $sth->fetchrow_array; 
    107110                if( $linkID ) { 
    108                         print LOG "$dbUser inserted new link $linkID via email\n"; 
     111                        print LOG "$now [successfull likn-by-mail] $dbUser, link $linkID\n"; 
    109112 
    110113                        $qs = "SELECT ID FROM linksGroups WHERE name = ? AND userid = ? AND isPrivate IS NULL"; 
     
    147150 
    148151                        } else { 
    149                                 print LOG "cant find a tag for this link, searching for '$tagName' failed, and adding a new one failed"; 
     152                                print LOG "$now [link-by-mail no tag found] $dbUser, '$tagName'\n"; 
    150153                                die( "cant find a tag for this link, searching for '$tagName' failed, and adding a new one failed" ); 
    151154                        } 
    152155                } 
    153156        } else { 
    154                 print LOG "The email address $submitter isn't registered with any Feed Me Links user. Perhaps you registered under another name?"; 
     157                print LOG "$now [unregistered link-by-mail attempt] $submitter\n"; 
    155158                die( "The email address $submitter isn't registered with any Feed Me Links user. Perhaps you registered under another name?" ); 
    156159        }