$logger->log(sprintf('framework.security.initialize.user: %s / %s / %s', $user->getId(), $user->getWholeName(), $user->getEmail()));
    });
    THCFrame\Events\Events::add('framework.security.initialize.after', function ($type) use($logger) {
        $logger->log(sprintf('framework.security.initialize.after: %s', $type));
    });
    THCFrame\Events\Events::add('framework.authentication.initialize.before', function ($type) use($logger) {
        $logger->log(sprintf('framework.authentication.initialize.before: %s', $type));
    });
    THCFrame\Events\Events::add('framework.authentication.initialize.after', function ($type) use($logger) {
        $logger->log(sprintf('framework.authentication.initialize.after: %s ', $type));
    });
    THCFrame\Events\Events::add('framework.authorization.initialize.before', function ($type) use($logger) {
        $logger->log(sprintf('framework.authorization.initialize.before: %s', $type));
    });
    THCFrame\Events\Events::add('framework.authorization.initialize.after', function ($type) use($logger) {
        $logger->log(sprintf('framework.authorization.initialize.after: %s ', $type));
    });
    // log view events
    THCFrame\Events\Events::add('framework.view.construct.before', function ($file) use($logger) {
        $logger->log(sprintf('framework.view.construct.before: %s', $file));
    });
    THCFrame\Events\Events::add('framework.view.construct.after', function ($file, $template) use($logger) {
        $logger->log(sprintf('framework.view.construct.after: %s', $file));
    });
    THCFrame\Events\Events::add('framework.view.render.before', function ($file) use($logger) {
        $logger->log(sprintf('framework.view.render.before: %s', $file));
    });
    THCFrame\Events\Events::add('plugin.mobiledetect.devicetype', function ($type) use($logger) {
        $logger->log(sprintf('plugin.mobiledetect.devicetype: %s', $type));
    });
}
<?php

if (!isset($_SESSION['app_devicetype'])) {
    require_once 'MobileDetect.php';
    $detect = new MobileDetect();
    if ($detect->isMobile() && !$detect->isTablet()) {
        $deviceType = 'phone';
    } elseif ($detect->isTablet() && !$detect->isMobile()) {
        $deviceType = 'tablet';
    } else {
        $deviceType = 'computer';
    }
    $_SESSION['app_devicetype'] = $deviceType;
} else {
    $deviceType = $_SESSION['app_devicetype'];
}
THCFrame\Events\Events::fire('plugin.mobiledetect.devicetype', array($deviceType));