Skip to content

Commit 311d0b2

Browse files
authored
Update docs (#11)
1 parent 0ff92cf commit 311d0b2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ Pepe is a swift package, so all you need to do is add the package via Xcode and
99
## How to use?
1010

1111
`Pepe` will provide you the logger that you need. For that, you need to be polite and use the method `loggerPlease()`.
12-
```
12+
```swift
1313
let logger = Pepe.loggerPlease()
1414
```
1515
Once you have a logger, you can start logging the messages that you need.
16-
```
16+
```swift
1717
logger.log("Hello world!")
1818
// this would log: "🐸: Hello world!"
1919
```
@@ -29,7 +29,7 @@ There are four different types of levels.
2929

3030
You set the level when you are going to log a message, for example:
3131

32-
```
32+
```swift
3333
logger.log("some message", level: .debug)
3434
```
3535

@@ -40,7 +40,7 @@ logger.log("some message", level: .debug)
4040
### Modifiers
4141
In case you need to modify the logging format, you have to use the `LogModifiers`. There's a property in the logger called `modifiers` that you can update. For example, let's suppose you need to show the log level and the time at which it was created, you would need to do the following.
4242

43-
```
43+
```swift
4444
logger.modifiers = [.level, .time]
4545
logger.log("Modified log")
4646
// this would log: "[INFO] 00:00:00.0000 modified log"
@@ -55,7 +55,7 @@ A writer basically means "how do you want to log something". At the moment, Pepe
5555
- console: it will use the `print()` function.
5656
- os: it will use the os logging system via the `os_log()` function.
5757

58-
```
58+
```swift
5959
// if you want to use the os logging system
6060
logger.writer = .os(subsystem: "foo", category: "bar")
6161
// notice that .console is the default value
@@ -69,15 +69,15 @@ Pepe supports logging in a syncronous scope and a non-sysncronous one.
6969

7070
If you don't want to block your current Thread, this is what you have to use. For this kind of execution, you need to provide a DispatchQueue where the logging will run asyncronously.
7171

72-
```
72+
```swift
7373
logger.executionType = .async(DispatchQueue.global())
7474
```
7575

7676
#### Sync
7777

7878
If you want to block the current Thread, you can use this type of execution. under the hood, it uses an `NSBlock`.
7979

80-
```
80+
```swift
8181
// This is the default value
8282
logger.executionType = .sync
83-
```
83+
```

0 commit comments

Comments
 (0)