daithi-coombes/api-connection-manager — pull request #37 by daithi-coombes (2013-05-05 09:43:03+00:00)
Title: Set up logging

Logging is working, but an absolute mess. Its currently hacked together when trying to solve a previous issue (not reporting the calling method). This needs to be cleaned up

May need two log files, when debugging SOAP calls to remote servers the data return is clearing the log file and starting afresh.
- one for outgoing, or internal logs
- another for incoming (callback) calls

The following is necessary to get the logger to report the method/call made to the `API_Connection_Manager::log()` method instead of reporting the `log()` method.
```php
// Manually construct a logging event
$level = LoggerLevel::toLevel($level);
$logger = Logger::getLogger(__CLASS__);
$event = new LoggerLoggingEvent(__CLASS__, $logger, $level, $msg);

// Override the location info
$bt = debug_backtrace();
$caller = array_shift($bt);
$location = new LoggerLocationInfo($caller);
$event->setLocationInformation($location);

// Log it
$logger->logEvent($event);
```

Issue is that we are creating a new logger object. Maybe better if we can use the one global object and then set the `__CLASS__` in `::log()`.

Currently, log file is created/tested in:
- `index.php`
- `API_Connection_Manager::__construct()`
- `API_Con_Mngr_Module::__construct()`
- `API_Con_Mngr_Setup::__construct()`
- `API_Con_Mngr_User::__construct()`