Skip to content

Instantly share code, notes, and snippets.

Created March 16, 2015 12:04
Show Gist options
  • Save anonymous/e9f0eb0443d17e751e6d to your computer and use it in GitHub Desktop.
Save anonymous/e9f0eb0443d17e751e6d to your computer and use it in GitHub Desktop.
<?php
namespace Typovision\Simpleblog\Service;
class SignalService implements \TYPO3\CMS\Core\SingletonInterface {
public function handleInsertEvent(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object, $signalInformation) {
if($object instanceof \Typovision\Simpleblog\Domain\Model\Blog) {
$logfile = "C:\\xampp\\htdocs\\t3Test\\testLog.txt";
\TYPO3\CMS\Extbase\Utility\GeneralUtility::writeFile($logfile, "test");
}
}
}
?>
<?php
namespace Typovision\Simpleblog\Service;
class SignalService implements \TYPO3\CMS\Core\SingletonInterface {
public function handleInsertEvent(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object, $signalInformation) {
if($object instanceof \Typovision\Simpleblog\Domain\Model\Blog) {
$logfile = "C:\\xampp\\htdocs\\t3Test\\testLog.txt";
$handle = fopen($logfile, "a+");
fwrite($handle, "test");
fclose($handle);
}
}
}
?>
@stmllr
Copy link

stmllr commented Mar 16, 2015

/** File: AdditionalConfiguration.php*/
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Typovision']['Simpleblog']['writerConfiguration'] = array(
        \TYPO3\CMS\Core\Log\LogLevel::DEBUG => array(
                'TYPO3\CMS\Core\Log\Writer\FileWriter' => array(
                        'logFile' => 'C:\\xampp\\htdocs\\t3Test\\testLog.txt'
                ),
        ),
);

/** File: SignalService */

/** @var \Psr\Log\LoggerInterface  $logger */
$logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
$logger->debug('test');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment