summaryrefslogtreecommitdiffstats
path: root/lib/model/LogEntryPeer.php
blob: 53501dac1faf0dc8fd075cb194dd0f99b6a638f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

/**
 * Subclass for performing query and update operations on the 'log' table.
 *
 * 
 *
 * @package lib.model
 */ 
class LogEntryPeer extends BaseLogEntryPeer
{
	public static function log($message, $priority = LogEntry::PRIO_DEBUG)
	{
		$e = new LogEntry();
		$e->setMessage($message);
		$e->setPriority($priority);
		$e->setHost(gethostbyaddr($_SERVER["REMOTE_ADDR"]));
		$user = sfContext::getInstance()->getUser();
		if($user)
			$e->setUserId($user->getId());
		$e->save();
	}
}