PHP Classes

File: src/Generics/Logger/DumpLoggerTrait.php

Recommend this page to a friend!
  Classes of Maik Greubel   PHP Generics   src/Generics/Logger/DumpLoggerTrait.php   Download  
File: src/Generics/Logger/DumpLoggerTrait.php
Role: Class source
Content type: text/plain
Description: Trait for logging dumps
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Update of src/Generics/Logger/DumpLoggerTrait.php
Date: 6 months ago
Size: 623 bytes
 

Contents

Class file image Download
<?php

/**
 * This file is part of the PHP Generics package.
 *
 * @package Generics
 */
namespace Generics\Logger;

/**
 * Implementation for logging dumps of objects
 *
 * @author Maik Greubel <greubel@nkey.de>
 */
trait DumpLoggerTrait
{

    abstract public function
debug($message, array $context = array());

   
/**
     *
     * {@inheritdoc}
     * @see \Generics\Logger\DumpLogger::dump()
     */
   
public function dump($o)
    {
       
$out = var_export($o, true);
       
$this->debug("Contents of {object}\n{dump}", array(
           
'object' => gettype($o),
           
'dump' => $out
       
));
    }
}