\Phalcon\Logger\AdapterInterface proposal

41 views
Skip to first unread message

Wojtek Gancarczyk

unread,
Dec 3, 2012, 8:24:41 AM12/3/12
to phalcon-...@googlegroups.com
I am trying to implement my own logger and I have noticed that the AdapterInterface defines methods that are in my opinion redundant. Here is my proposal for the interface:

Following methods should be added to the \Phalcon\Logger\Adapter and removed from \Phalcon\Logger\Adapter\File

abstract public setFormat (string $format)
abstract public format getFormat ()
abstract public string getTypeString (integer $type)
abstract public setDateFormat (string $date)
abstract public string getDateFormat ()

I think that setting format and date format is not specific only for file adapter but can also be used while developing other adapters. This way I can either extend from \Phalcon\Logger\Adapter and implement \Phalcon\Logger\Adapter\AdapterInterface. In this case I can only concentrate on implementing my custom log storage.

class CustomLogger extends \Phalcon\Logger\Adapter implements \Phalcon\Logger\AdapterInterface {
    public function log($message, $type)
    {}
    public function begin()
    {}
    public function commit()
    {}
    public function rollback()
    {}
    public function close()
    {}
}

If I need custom implementation of methods mentioned above I will just implement the interface without extending the adapter.

Andres-Gutierrez

unread,
Dec 3, 2012, 8:07:26 PM12/3/12
to Wojtek Gancarczyk, phalcon-...@googlegroups.com
Hi Wojtek, I've been doing this work in the other components, it looks that this intermediate class is missing in this component.

2012/12/3 Wojtek Gancarczyk <ganca...@gmail.com>

--
 
 

Reply all
Reply to author
Forward
0 new messages