Skip to content

Commit

Permalink
Merge pull request #9 from Raizlabs/feature/jstricker/remove-check-re…
Browse files Browse the repository at this point in the history
…port

removed check/report
  • Loading branch information
jatraiz committed Apr 5, 2017
2 parents 88c031a + 08d7745 commit f37211c
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 109 deletions.
2 changes: 0 additions & 2 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ target 'Slog_Example' do

target 'Slog_Tests' do
inherit! :search_paths


end
end
24 changes: 7 additions & 17 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Slog/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

lifeCycleLog.verbose("App did finish launching with options: \(launchOptions)")
lifeCycleLog.verbose("App did finish launching with options: \(String(describing: launchOptions))")

return true
}
Expand Down
4 changes: 0 additions & 4 deletions Example/Slog/Slog.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ let log = Slog(name: "TEST", level: .verbose, useEmoji: true)

log.error("Here's an error")

let index = 1000
let array = ["One", "Two", "Three"]

log.check(index: index, isWithinBoundsOf: array)

31 changes: 5 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ A simple Swift logging library.

## Basic use

Initialize with a default level, and if emojis should be included in logs:
Initialize with a default level:
```Swift-3
let log = Slog(level: .warn, useEmoji: true)
let log = Slog(level: .warn)
```

Then you can log with functions for each of the log levels (with their associated emoji):
Expand All @@ -22,6 +22,8 @@ Then you can log with functions for each of the log levels (with their associate
* ⁉️   error
* off

The use of emojis defaults to `true`, you can set it to false either during initialization or by setting the `useEmoji` instance var.

For example:

```swift
Expand All @@ -41,7 +43,7 @@ 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
lifeCycleLog.verbose("App finished launching with options \(launchOptions)")
lifeCycleLog.verbose("App finished launching with options \(String(description: launchOptions))")
```

would print:
Expand All @@ -51,29 +53,6 @@ would print:
App did finish launching with options: nil
```

## Check and Report (under development)
Checks are designed to check if a condition is fulfilled, if it is not then an error is reported. Each check method should have a corresponding report method (though you can have report methods without a matching check method).

This is currently under development, so feel free to suggest new checks & reports as issues (or PRs).

### Checks

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

### Reports

```swift
// index is out of bounds of an array
report(index:, outOfBoundsOf: )

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


## Example Project

To run the example project, clone the repo, and run `pod install` from the Example directory first.
Expand Down
25 changes: 0 additions & 25 deletions Slog/Classes/Slog+CheckError.swift

This file was deleted.

30 changes: 0 additions & 30 deletions Slog/Classes/Slog+ReportError.swift

This file was deleted.

8 changes: 4 additions & 4 deletions Slog/Classes/Slog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ open class Slog {
/// The log level, defaults to .Off
public var logLevel: Level = .off

/// If true, prints emojis to signify log type, defaults to off
public var useEmoji: Bool = false
/// If true, prints emojis to signify log type, defaults to true
public var useEmoji: Bool = true

// MARK: Private
/// Date formatter for log
Expand All @@ -69,7 +69,7 @@ open class Slog {
/// - name: name of the log
/// - level: The minimum log level (.verbose for all)
/// - useEmoji: If true, use emoji as part of logging
public init(name: String, level: Level, useEmoji: Bool = false) {
public init(name: String, level: Level, useEmoji: Bool = true) {
self.name = name
self.logLevel = level
self.useEmoji = useEmoji
Expand All @@ -80,7 +80,7 @@ open class Slog {
/// - Parameters:
/// - level: The minimum log level (.verbose for all)
/// - useEmoji: If true, use emoji as part of logging
public convenience init(level: Level, useEmoji: Bool = false) {
public convenience init(level: Level, useEmoji: Bool = true) {
self.init(name: "", level: level, useEmoji: useEmoji)
}

Expand Down

0 comments on commit f37211c

Please sign in to comment.