Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for v1.1.0 #22

Merged
merged 14 commits into from
Jun 16, 2019
35 changes: 35 additions & 0 deletions documentation/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Users can configure the way the logger works and the image will use this configu
For specific cases, a specialized logger can be used.

- [User documentation of TinyLogger](#user-documentation-of-tinylogger)
* [Quick start](#quick-start)
* [Configure your logger](#configure-your-logger)
+ [Add sub-loggers to your `TinyLogger`](#add-sub-loggers-to-your--tinylogger-)
+ [Remove sub-loggers](#remove-sub-loggers)
Expand All @@ -16,6 +17,40 @@ For specific cases, a specialized logger can be used.
+ [Record a single line log](#record-a-single-line-log)
+ [Recording the execution of a task](#recording-the-execution-of-a-task)
* [Use another logger than the global logger](#use-another-logger-than-the-global-logger)

## Quick start

This section will explain in 30 seconds how to create a logger for an application and use it. Then we will explore more advance features.
jecisc marked this conversation as resolved.
Show resolved Hide resolved

Here is an example fo snippet to create a logger using a file `Progress.log`:
jecisc marked this conversation as resolved.
Show resolved Hide resolved

```Smalltalk
TinyLogger default
addFileLoggerNamed: 'Progress.log'.
```

This code need to be executed **one time** in the image. For an application, it will probably be added to a method *initialize* on the class side of a class to be executed one time at the loading of the project in the image.

In case you need to execute the code multiple times you can use this snippet instead:
jecisc marked this conversation as resolved.
Show resolved Hide resolved

```Smalltalk
TinyLogger default
ensureFileLoggerNamed: 'Progress.log'.
```

Then write a message to the log using `record`:

```Smalltalk
'Uh oh. Something happened.' record
```

Or wrap the execution of an action by logs using `execute:recordedAs:`:
jecisc marked this conversation as resolved.
Show resolved Hide resolved

```Smalltalk
self execute: [ "Some code doing something" ] recordedAs: 'Launching bananas.'
jecisc marked this conversation as resolved.
Show resolved Hide resolved
```

Now, if you want to know more about the project, let's proceed on a more detailed documentation.

## Configure your logger

Expand Down