}
// Set up error and exception handling
set_error_handler('tbg_error_handler');
set_exception_handler('tbg_exception');
error_reporting(E_ALL | E_STRICT);
if (!defined('THEBUGGENIE_PATH')) {
    throw new Exception('You must define the THEBUGGENIE_PATH constant so we can find the files we need');
}
// Load the context class, which controls most of things
require THEBUGGENIE_CORE_PATH . 'classes' . DS . 'TBGContext.class.php';
// Load the logging class so we can log stuff
require THEBUGGENIE_CORE_PATH . 'classes' . DS . 'TBGLogging.class.php';
// Start loading The Bug Genie
try {
    // Set the start time
    TBGContext::setLoadStart($starttime[1] + $starttime[0]);
    TBGLogging::log('Initializing Caspar framework');
    TBGLogging::log('PHP_SAPI says "' . PHP_SAPI . '"');
    if (!isset($argc) && !ini_get('session.auto_start')) {
        session_name(THEBUGGENIE_SESSION_NAME);
        session_start();
    }
    // Add classpath so we can find the TBG* classes
    TBGContext::addClasspath(THEBUGGENIE_CORE_PATH . 'classes' . DS);
    TBGLogging::log(TBGCache::isEnabled() ? 'APC cache is enabled' : 'APC cache is not enabled');
    TBGLogging::log('Loading B2DB');
    try {
        TBGLogging::log('Adding B2DB classes to autoload path');
        define('B2DB_BASEPATH', THEBUGGENIE_CORE_PATH . 'B2DB' . DS);
        define('B2DB_CACHEPATH', THEBUGGENIE_CORE_PATH . 'cache' . DS . 'B2DB' . DS);
        TBGContext::addClasspath(THEBUGGENIE_CORE_PATH . 'B2DB' . DS . 'classes' . DS);