Refactoring TYPO3 Logging

26
Refactoring TYPO3 Logging Image by “digital cat”: http://www.flickr.com/people/14646075@N03/

description

Slides for a workshop at TYPO3 Developer Days 2012 which was called: "Refactoring TYPO3 Logging". The slides mainly cover two topics: The current Logging dilemma in TYPO3v4 and the architecture of the new Logging API in TYPO3v6

Transcript of Refactoring TYPO3 Logging

RefactoringTYPO3 Logging

Image by “digital cat”: http://www.flickr.com/people/14646075@N03/

About me

✗ Steffen Müller✗ /gebrüderheitz GbR ✗ Freiburg/Germany

✗ TYPO3 developer✗ 9 years experience with TYPO3

✗ Twitter: @t3node✗ TYPO3 Blog: http://www.t3node.com

Refactoring TYPO3 Logging at #t3dd12

Main Project Team

Refactoring TYPO3 Logging at #t3dd12

Steffen MüllerIngo Renner

Steffen Gebert

About you

Tell us in 2-3 Sentences:

✗ Who are you?✗ What are your TYPO3 skills?✗ What you expect from the workshop?

Then add yourself to the Forge Project:http://forge.typo3.org/projects/typo3v4-logging

Refactoring TYPO3 Logging at #t3dd12

Image by Dierk Schaefer: http://www.flickr.com/people/dierkschaefer/

Workshop Topics

✗ Overview✗ Project goals ✗ What has been done so far?

✗ Hands on✗ Test and review the Logging API✗ Code some nasty stuff✗ Your suggested topic!

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

The Logging Dilemma

Refactoring TYPO3 Logging at #t3dd12

Refactoring Goals

Refactoring TYPO3 Logging at #t3dd12

✗ New Logging API✗ Replace existing log calls in core with new API calls✗ New BE module✗ Showcase extensions✗ Documentation

What has been done so far?

Refactoring TYPO3 Logging at #t3dd12

✗ New Logging API in t3lib/log/✗ Incubator git repository✗ Proof-of-concept:

✗ Configuration $TYPO3_CONF_VARS['LOG']✗ Replaced t3lib_div::devLog and sysLog

The new Logging API

Refactoring TYPO3 Logging at #t3dd12

✗ A single API✗ Extensible✗ Configurable✗ Up to 100% covered with UnitTests

API Overview

Refactoring TYPO3 Logging at #t3dd12

LogManager

Refactoring TYPO3 Logging at #t3dd12

LogLogger

Refactoring TYPO3 Logging at #t3dd12

LogLevel

Refactoring TYPO3 Logging at #t3dd12

LogRecord

Refactoring TYPO3 Logging at #t3dd12

LogRecord

Refactoring TYPO3 Logging at #t3dd12

LogWriters

Refactoring TYPO3 Logging at #t3dd12

Example usage

Refactoring TYPO3 Logging at #t3dd12

✗ Instanciate Logger:$logger = t3lib_log_LogManager::getLogger(__CLASS__);

✗ Write log event:$logger->log(t3lib_log_Level::ERROR, 'My Message');

✗ Shorthand syntax:$logger->error('My Message');

✗ Additional data:$logger->debug('My Message', array('foo' => 'bar'));

✗ Method chaining:t3lib_log_LogManager::getLogger(__CLASS__)->error('lol');

Possible Workgroups

Refactoring TYPO3 Logging at #t3dd12

✗ Testing and reviewing the current API code✗ Coding a custom LogWriter extension✗ Porting the current code to a backport extension✗ Configuration✗ Performance / Profiling

Project Resources

Refactoring TYPO3 Logging at #t3dd12

✗ Logging API directory: t3lib/log/✗ Workshop Wiki:

http://forge.typo3.org/projects/typo3v4-logging/wiki/T3DD12-Workshop

✗ Forge Project: Logging Improvementshttp://forge.typo3.org/projects/typo3v4-logging

✗ Git: Incubator, branch project-logging-t3dd12git://git.typo3.org/TYPO3v4/Incubator.git