Skip to content

Commit

Permalink
Merge pull request #7 from Raizlabs/ZevEisenberg-patch-1
Browse files Browse the repository at this point in the history
Use correct formatting for fenced code blocks
  • Loading branch information
jatraiz committed Mar 23, 2017
2 parents 2ecb4da + 93fd71d commit 88c031a
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ Then you can log with functions for each of the log levels (with their associate
* off

For example:
```Swift-3

```swift
log.error("This is an error!")
```
Setting the level of a log will only print out those logs at that level or above.
```Swift-3

```swift
log.level = .verbose
```
You can also initialize a log with a name. You may want to have different logs for App Lifecycle, API, UI, Data, etc. This would allow you to have different logs & set different log levels depending upon what you are trying to monitor or track down. The log name will be printed out as part of any log message for that log.
```Swift-3

```swift
let lifeCycleLog = Slog(name:"LifeCycle", level: .verbose, useEmoji: true)
```

You could use this log in the AppDelegate to monitor app lifecycles. For example putting this code in `didFinishLaunchingWithOptions`:
```Swift-3

```swift
lifeCycleLog.verbose("App finished launching with options \(launchOptions)")
```

Expand All @@ -53,18 +57,20 @@ Checks are designed to check if a condition is fulfilled, if it is not then an e
This is currently under development, so feel free to suggest new checks & reports as issues (or PRs).

### Checks
```Swift-3
// index is within the bounds of an array
check(index:, isInBoundsOf:)

```swift
// index is within the bounds of an array
check(index:, isInBoundsOf:)
```

### Reports
```Swift-3
// index is out of bounds of an array
report(index:, outOfBoundsOf: )

// unxpected nil for a variable
report(unexpectedNil:)
```swift
// index is out of bounds of an array
report(index:, outOfBoundsOf: )

// unxpected nil for a variable
report(unexpectedNil:)
```


Expand All @@ -82,9 +88,11 @@ pod "Slog"
```

If you don't want to use the check and report features, then you can use the LogOnly subspec:

```ruby
pod "Slog/LogOnly"
```

## Author

John Stricker, john.stricker@raizlabs.com
Expand Down

0 comments on commit 88c031a

Please sign in to comment.