|
| 1 | +# Migration guide v1 to v2 |
| 2 | + |
| 3 | +Between the v1 and v2 some things changed. |
| 4 | + |
| 5 | +## Drop P6 compatibility |
| 6 | + |
| 7 | +V2 does not work anymore with Pharo 6 and 6.1. If your project is on Pharo 6, keep using the version 1 of TinyLogger. |
| 8 | + |
| 9 | +## Cannot add a logger created from #for: |
| 10 | + |
| 11 | +In the past it was possible to do: |
| 12 | + |
| 13 | +```Smalltalk |
| 14 | +TinyLogger default addLogger: (TinyTranscriptLogger for: TinyLogger default) |
| 15 | +``` |
| 16 | + |
| 17 | +Now this does not work anymore because #`for:` is now adding itself to the parameter. If you still do this, yu will end up with the logger duplicated. |
| 18 | + |
| 19 | +You can now do: |
| 20 | + |
| 21 | +```Smalltalk |
| 22 | +TinyLogger default addLogger: TinyTranscriptLogger new |
| 23 | +``` |
| 24 | + |
| 25 | +or: |
| 26 | + |
| 27 | +```Smalltalk |
| 28 | +TinyLogger default addTrascriptLogger "or ensureTranscriptLogger" |
| 29 | +``` |
| 30 | + |
| 31 | +## Removal of the leading space before colon |
| 32 | + |
| 33 | +In v1 the timestamp was followed by a space before the colon. |
| 34 | + |
| 35 | +Like this: |
| 36 | + |
| 37 | +``` |
| 38 | +2018-11-29T23:19:55.511775+01:00 : This is a string to log |
| 39 | +``` |
| 40 | + |
| 41 | +In the v2 this was removed. If you want this space, you can add it the the #`timestampFormatBlock:`. |
| 42 | + |
| 43 | +```Smalltalk |
| 44 | +TinyLogger default timestampFormatBlock: [ :aStream :timestamp | aStream << timestamp asString << ' ' ] |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | +## Option execution block indentation |
| 49 | + |
| 50 | +In the past, using `#execute:recordedAs:` was adding some extra indentation like this: |
| 51 | + |
| 52 | +```Smalltalk |
| 53 | +self execute: [ 'Log' record ] recordedAs: 'Task' |
| 54 | +``` |
| 55 | + |
| 56 | +``` |
| 57 | +2018-11-29T23:21:04.897775+01:00: Begin: Task |
| 58 | +2018-11-29T23:21:04.900775+01:00: Log |
| 59 | +2018-11-29T23:21:04.909775+01:00: End: Task |
| 60 | +``` |
| 61 | + |
| 62 | +Now it prints like this: |
| 63 | + |
| 64 | +``` |
| 65 | +2018-11-29T23:21:04.897775+01:00: Begin: Task |
| 66 | +2018-11-29T23:21:04.900775+01:00: Log |
| 67 | +2018-11-29T23:21:04.909775+01:00: End: Task |
| 68 | +``` |
| 69 | + |
| 70 | +In order to get the previous behavior you can use `#indentExecutionBlock:` like this: |
| 71 | + |
| 72 | +```Smalltalk |
| 73 | +TinyLogger default indentExecutionBlock: true |
| 74 | +``` |
0 commit comments