PHP 클래스 Phergie_Plugin_Logging, phergie

CONFIGURATION: The following configuration items are required, only 'retry' is optional: 'logging.dsn' = A PDO DSN string to connect to your database 'logging.user' = Username for your database access 'logging.pass' = Password for the same: 'logging.table' = Table name to store data in 'logging.dsn' => 'mysql:host=127.0.0.1;port=3306;dbname=test;charset=utf8', 'logging.user' => 'MyUser', 'logging.pass' => 'UserPassword', 'logging.table' => 'phergie', DATA SCHEMA: You will need to have created an appropriate database table to store these log entries. At a minimum it needs to include host, channel, type, nick, and message fields. Beyond that you can get creative. The following is an example table structure you might use: CREATE TABLE phergie_log ( id int(11) unsigned NOT NULL AUTO_INCREMENT, host varchar(265) NOT NULL, channel varchar(50) NOT NULL, type varchar(10) NOT NULL, nick varchar(50) NOT NULL, message varchar(1024) NULL, created_on timestamp DEFAULT current_timestamp NOT NULL, PRIMARY KEY (id), INDEX idx_phergie_chan (channel) ) ENGINE = innodb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
저자: Eli White ([email protected])
상속: extends Phergie_Plugin_Abstract
파일 보기 프로젝트 열기: phergie/phergie

보호된 프로퍼티들

프로퍼티 타입 설명
$db PDO Database connection
$failed Remembers if we've failed our database connection and given up.

공개 메소드들

메소드 설명
onAction ( ) : void onAction
onJoin ( ) : void onJoin
onLoad ( ) : void onLoad
onPart ( ) : void onPart
onPrivmsg ( ) : void onPrivmsg
preDispatch ( ) : void preDispatch

보호된 메소드들

메소드 설명
log ( Phergie_Event_Request $event, string $nick, string $message = NULL ) : void log

비공개 메소드들

메소드 설명
_connectDB ( ) : boolean _connectDB
_log ( Phergie_Event_Request $event, string $nick, string $message = NULL ) : boolean _log

메소드 상세

log() 보호된 메소드

Wrapper method on the logging that adds in additional features, such as error handling and retrying the long living database connection in case it dropped.
저자: Eli White ([email protected])
protected log ( Phergie_Event_Request $event, string $nick, string $message = NULL ) : void
$event Phergie_Event_Request The event we are operating on
$nick string Who did this?
$message string What was said?
리턴 void

onAction() 공개 메소드

Handler for when the bot receives a CTCP ACTION request.
저자: Eli White ([email protected])
public onAction ( ) : void
리턴 void

onJoin() 공개 메소드

Handler for when a user joins a channel.
저자: Eli White ([email protected])
public onJoin ( ) : void
리턴 void

onLoad() 공개 메소드

Prepare for logging
저자: Eli White ([email protected])
public onLoad ( ) : void
리턴 void

onPart() 공개 메소드

Handler for when a user leaves a channel.
저자: Eli White ([email protected])
public onPart ( ) : void
리턴 void

onPrivmsg() 공개 메소드

Watches for & logs any incoming messages from the channel
저자: Eli White ([email protected])
public onPrivmsg ( ) : void
리턴 void

preDispatch() 공개 메소드

Processes events before they are dispatched and logs appropriate ones.
저자: Eli White ([email protected])
public preDispatch ( ) : void
리턴 void

프로퍼티 상세

$db 보호되어 있는 프로퍼티

Database connection
protected PDO $db
리턴 PDO

$failed 보호되어 있는 프로퍼티

Remembers if we've failed our database connection and given up.
protected $failed