mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Adding some more commonly used SS_Log priority constants.
This commit is contained in:
parent
11cc27f700
commit
9c2ddd4850
@ -49,6 +49,8 @@ class SS_Log {
|
|||||||
const ERR = Zend_Log::ERR;
|
const ERR = Zend_Log::ERR;
|
||||||
const WARN = Zend_Log::WARN;
|
const WARN = Zend_Log::WARN;
|
||||||
const NOTICE = Zend_Log::NOTICE;
|
const NOTICE = Zend_Log::NOTICE;
|
||||||
|
const INFO = Zend_Log::INFO;
|
||||||
|
const DEBUG = Zend_Log::DEBUG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger class to use.
|
* Logger class to use.
|
||||||
|
@ -49,9 +49,10 @@ class SS_LogTest extends SapphireTest {
|
|||||||
$testEmailWriter = new SS_LogEmailWriter('test@test.com');
|
$testEmailWriter = new SS_LogEmailWriter('test@test.com');
|
||||||
SS_Log::add_writer($testEmailWriter, SS_Log::ERR);
|
SS_Log::add_writer($testEmailWriter, SS_Log::ERR);
|
||||||
|
|
||||||
SS_Log::log('Email test', SS_LOG::ERR, array('my-string' => 'test', 'my-array' => array('one' => 1)));
|
SS_Log::log('Email test', SS_Log::ERR, array('my-string' => 'test', 'my-array' => array('one' => 1)));
|
||||||
$this->assertEmailSent('test@test.com');
|
$this->assertEmailSent('test@test.com');
|
||||||
$email = $this->findEmail('test@test.com');
|
$email = $this->findEmail('test@test.com');
|
||||||
|
$this->assertContains('[Error] Email test', $email['htmlContent']);
|
||||||
$parser = new CSSContentParser($email['htmlContent']);
|
$parser = new CSSContentParser($email['htmlContent']);
|
||||||
$extras = $parser->getBySelector('table.extras');
|
$extras = $parser->getBySelector('table.extras');
|
||||||
$extraRows = $extras[0]->tr;
|
$extraRows = $extras[0]->tr;
|
||||||
@ -65,6 +66,24 @@ class SS_LogTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testEmailWriterDebugPriority() {
|
||||||
|
$testEmailWriter = new SS_LogEmailWriter('test@test.com');
|
||||||
|
SS_Log::add_writer($testEmailWriter, SS_Log::DEBUG);
|
||||||
|
SS_Log::log('Test something', SS_Log::DEBUG, array('my-string' => 'test', 'my-array' => array('one' => 1)));
|
||||||
|
$this->assertEmailSent('test@test.com');
|
||||||
|
$email = $this->findEmail('test@test.com');
|
||||||
|
$this->assertContains('[DEBUG] Test something', $email['htmlContent']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEmailWriterInfoPriority() {
|
||||||
|
$testEmailWriter = new SS_LogEmailWriter('test@test.com');
|
||||||
|
SS_Log::add_writer($testEmailWriter, SS_Log::INFO);
|
||||||
|
SS_Log::log('Test something', SS_Log::INFO, array('my-string' => 'test', 'my-array' => array('one' => 1)));
|
||||||
|
$this->assertEmailSent('test@test.com');
|
||||||
|
$email = $this->findEmail('test@test.com');
|
||||||
|
$this->assertContains('[INFO] Test something', $email['htmlContent']);
|
||||||
|
}
|
||||||
|
|
||||||
protected function exceptionGeneratorThrower() {
|
protected function exceptionGeneratorThrower() {
|
||||||
throw new Exception("thrown from SS_LogTest::testExceptionGeneratorTop");
|
throw new Exception("thrown from SS_LogTest::testExceptionGeneratorTop");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user