// Get all currently active singleton instances $instances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances(); // Loop through the array and output the classname of each singleton instance foreach ($instances as $instance) { echo get_class($instance) . '
'; }
// Get the sys_log singleton instance $log = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger(__CLASS__); // Log a message $log->info('Hello world!');This code gets the singleton instance of the TYPO3 Core logger and logs a message to it. Package library: TYPO3\CMS\Core\Utility\GeneralUtility