Пример #1
0
 /**
  * Basic assertions of a new Growl Channel object
  */
 public function testGrowlChannel()
 {
     $obj = ChannelFactory::Growl('testapp');
     $this->assertInstanceOf('Talkback\\Channel\\Growl', $obj);
     $this->assertInstanceOf('Talkback\\Channel\\ChannelAbstract', $obj);
     $this->assertInstanceOf('Talkback\\Object', $obj);
     $this->assertInstanceOf('Talkback\\Channel\\Channelinterface', $obj);
 }
Пример #2
0
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @category  File
 * @package   talkback
 * @author    Chris Noden <*****@*****.**>
 * @copyright 2013 Chris Noden
 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 * @link      https://github.com/chrisnoden
 */
require '../vendor/autoload.php';
/**
 * Create a Talkback collection
 *
 * A File channel outputs all events to /tmp/test.log
 * A Basic channel will output CRITICAL events to console
 * A Growl channel will show all INFO events
 */
$logger = \Talkback\Logger::getLogger('complex logger');
$logger->addChannel(array(\Psr\Log\LogLevel::ERROR, \Psr\Log\LogLevel::CRITICAL, \Psr\Log\LogLevel::ALERT, \Psr\Log\LogLevel::EMERGENCY, \Psr\Log\LogLevel::INFO, \Psr\Log\LogLevel::NOTICE, \Psr\Log\LogLevel::WARNING, \Psr\Log\LogLevel::DEBUG), \Talkback\Channel\ChannelFactory::File('/tmp/test.log'))->addChannel(\Psr\Log\LogLevel::CRITICAL, \Talkback\Channel\ChannelFactory::Basic())->addChannel(\Psr\Log\LogLevel::INFO, \Talkback\Channel\ChannelFactory::Growl('Bundle'));
/**
 * Send an INFO event which will appear in the File log and on Growl
 */
$logger->info('My goodness this is good information');
// dump the log file to the console
$file = file_get_contents('/tmp/test.log');
echo "Your file contains:" . PHP_EOL . $file;
// clean up
unlink('/tmp/test.log');
Пример #3
0
 /**
  * You should be able to chain the addHandler calls
  *
  * @depends testAddingValidHandler
  */
 public function testChainedHandlers()
 {
     $obj = new Router();
     $obj->addChannel(array(LogLevel::EMERGENCY, LogLevel::ERROR), ChannelFactory::Basic())->addChannel(LogLevel::INFO, ChannelFactory::Growl('Test App'));
 }