My favorites
▼
|
Sign in
mrclay
Steve Clay's classes, functions, snippets, and whatzits
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
php
/
MrClay
/
FireLog.php
‹r36
r84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* This class allows you to use Zend_Wildfire_Plugin_FirePhp more like the old
* FirePHP class. I.e. without managing request/response objects and flushing the
* Wildfire channel.
*
* FireLog does two things: 1. It proxies Zend_Log method calls to an internal
* Zend_Log. 2. It proxies the send, group, and groupEnd methods of
* Zend_Wildfire_Plugin_FirePhp. In both cases the headers are set immediately.
*
* <code>
* $log = MrClay_FireLog::getInstance();
*
* // Zend_Log methods
* $log->info('An informational message.');
* $log->warn('A warning!');
*
* // Zend_Wildfire_Plugin_FirePhp methods
* $log->group('My Group');
* $log->send('Hello from the group.');
* $log->groupEnd();
* </code>
*
* @author Steve Clay <steve@mrclay.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
class MrClay_FireLog {
/**
* @var Zend_Wildfire_Channel_HttpHeaders
*/
protected $_channel;
/**
* @var Zend_Log
*/
protected $_log;
protected function __construct()
{
$this->_channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
$this->_channel->setResponse(new MrClay_FireLog_Response());
$this->_channel->setRequest(new Zend_Controller_Request_Http());
$writer = new MrClay_FireLog_Writer();
$writer->setWildfireChannel($this->_channel);
$this->_log = new Zend_Log($writer);
}
/**
* @return MrClay_FireLog
*/
public static function getInstance()
{
static $instance = null;
if (null === $instance) {
$instance = new self();
}
return $instance;
}
/**
* Proxy calls back to Zend_Log
*/
public function __call($name, $arguments) {
call_user_func_array(array($this->_log, $name), $arguments);
}
/**
* @return Zend_Log
*/
public function getLog()
{
return $this->_log;
}
/**
* Logs variables to the Firebug Console
* via HTTP response headers and the FirePHP Firefox Extension.
*
* @param mixed $var The variable to log.
* @param string $label OPTIONAL Label to prepend to the log event.
* @param string $style OPTIONAL Style of the log event.
* @param array $options OPTIONAL Options to change how messages are processed and sent
* @return boolean Returns TRUE if the variable was added to the response headers or buffered.
* @throws Zend_Wildfire_Exception
*/
public function send($var, $label=null, $style=null, $options=array())
{
$r = Zend_Wildfire_Plugin_FirePhp::send($var, $label, $style, $options);
$this->_channel->flush();
return $r;
}
/**
* Starts a group in the Firebug Console
*
* @param string $title The title of the group
* @return TRUE if the group instruction was added to the response headers or buffered.
*/
public function group($title)
{
$r = Zend_Wildfire_Plugin_FirePhp::group($title);
$this->_channel->flush();
return $r;
}
/**
* Ends a group in the Firebug Console
*
* @return TRUE if the group instruction was added to the response headers or buffered.
*/
public function groupEnd()
{
$r = Zend_Wildfire_Plugin_FirePhp::groupEnd();
$this->_channel->flush();
return $r;
}
}
Show details
Hide details
Change log
r83
by mrclay.org on Feb 28, 2012
Diff
Add license. Some needed cleanup
Go to:
/trunk/php/Coewp/JsonApi.php
/trunk/php/Coewp/MenuFilter.php
...hp/Coewp/ShortCode/Accordion.php
...ShortCode/Accordion/Renderer.php
...oewp/ShortCode/PageAccordion.php
/trunk/php/MrClay/AutoP.php
/trunk/php/MrClay/Bench.php
...nk/php/MrClay/CachedFunction.php
...ay/CachedFunction/Cache/File.php
/trunk/php/MrClay/Cli.php
/trunk/php/MrClay/Cli/Arg.php
.../php/MrClay/Crypt/ByteString.php
...php/MrClay/Crypt/Cipher/Base.php
...lay/Crypt/Cipher/Rijndael256.php
...k/php/MrClay/Crypt/Container.php
...MrClay/Crypt/Encoding/Base64.php
...lay/Crypt/Encoding/Base64Url.php
...t/Encoding/EncodingInterface.php
.../php/MrClay/Crypt/Encryption.php
.../php/MrClay/Crypt/KeyDeriver.php
.../MrClay/Crypt/PasswordHasher.php
...p/MrClay/Crypt/SignedRequest.php
/trunk/php/MrClay/FireLog.php
.../php/MrClay/FireLog/Response.php
...nk/php/MrClay/FireLog/Writer.php
/trunk/php/MrClay/HashUtils.php
...hp/MrClay/Hmac/SignedRequest.php
/trunk/php/MrClay/Html.php
/trunk/php/MrClay/JsonFormatter.php
/trunk/php/MrClay/LinkHelper.php
...lay/LinkHelper/LinkOrWrapper.php
...p/MrClay/LinkHelper/ListItem.php
...MrClay/LinkHelper/OpenAnchor.php
/trunk/php/MrClay/LiveOutput.php
.../MrClay/LiveOutput/Processor.php
...p/MrClay/LiveOutput/Renderer.php
/trunk/php/MrClay/Loader.php
/trunk/php/MrClay/Minitest.php
.../MrClay/NewPasswordValidator.php
/trunk/php/MrClay/QAD/App.php
...p/MrClay/QAD/ErrorController.php
/trunk/php/MrClay/QAD/View.php
...ay/QAD/View/CallbackResolver.php
/trunk/php/MrClay/Replay.php
/trunk/php/MrClay/RootFinder.php
...hp/MrClay/RootFinder/WetBulb.php
...nk/php/MrClay/SendmailFilter.php
/trunk/php/MrClay/StaticWrapper.php
/trunk/php/MrClay/StringDebug.php
/trunk/php/MrClay/Template.php
Project members,
sign in
to write a code review
Older revisions
r36
by st...@mrclay.org on Jan 24, 2011
Diff
replaced Firephp with FireLog
All revisions of this file
File info
Size: 3415 bytes, 119 lines
View raw file
Powered by
Google Project Hosting