Skip to content

Commit

Permalink
Merge pull request #17 from appunite/0.2.0
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
lewandowskit93 authored Jan 24, 2020
2 parents 13bb075 + c9068b5 commit fb1c7f3
Show file tree
Hide file tree
Showing 23 changed files with 648 additions and 135 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ script:
- set -o pipefail
- swift --version
- xcodebuild clean build test -workspace "$WORKSPACE" -scheme "$IOS_SCHEME" -destination "$IOS_DESTINATION" | xcpretty
- bash <(curl -s https://codecov.io/bash)
- xcodebuild clean build test -workspace "$WORKSPACE" -scheme "$TVOS_SCHEME" -destination "$TVOS_DESTINATION" | xcpretty
- xcodebuild clean build test -workspace "$WORKSPACE" -scheme "$MACOS_SCHEME" -destination "$MACOS_DESTINATION" | xcpretty
- xcodebuild clean build -workspace "$WORKSPACE" -scheme "$WATCHOS_SCHEME" -destination "$WATCHOS_DESTINATION" | xcpretty
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.2.0]
- Add decorated formatter
- Add decorator for level color changing
- Add decorator for level emoji prefixes
- Add codecov badge

## [0.1.0]
- Add .travis.yml for CI support
- Fix support for package manager
Expand Down
2 changes: 1 addition & 1 deletion Configurations/Common.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SPY_BUNDLE_IDENTIFIER = com.appunite.spy
SPY_PROVISIONING_PROFILE_SPECIFIER =

VERSIONING_SYSTEM = apple-generic
PRODUCT_VERSION = 0.1.0
PRODUCT_VERSION = 0.2.0
SWIFT_VERSION = 5.0
CODE_SIGN_STYLE = Manual

7 changes: 5 additions & 2 deletions Example/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import Spy
public struct Environment {
public static var spy: AnySpy<SpyLevel, SpyChannel> = {
return CompositeSpy()
.add(spy: ConsoleSpy<SpyLevel, SpyChannel, RawSpyFormatter>(
spyFormatter: RawSpyFormatter(),
.add(spy: ConsoleSpy<SpyLevel, SpyChannel, DecoratedSpyFormatter>(
spyFormatter: DecoratedSpyFormatter(
levelNameBuilder: DecoratedLevelNameBuilder<SpyLevel>()
.add(decorator: EmojiPrefixedSpyLevelNameDecorator().toAnyDecorator())
),
timestampProvider: CurrentTimestampProvider(),
configuration: SpyConfigurationBuilder()
.add(levels: SpyLevel.levelsFrom(loggingLevel))
Expand Down
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/appunite/Spy.svg?branch=master)](https://travis-ci.org/appunite/Spy)
[![codecov](https://codecov.io/gh/appunite/Spy/branch/master/graph/badge.svg)](https://codecov.io/gh/appunite/Spy)
[![Carthage compatible](https://img.shields.io/badge/Carthage-Compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Cocoapods](https://img.shields.io/cocoapods/v/Spy.svg?style=flat)](https://cocoapods.org/pods/Spy)
[![Platform](https://img.shields.io/cocoapods/p/Spy.svg?style=flat)](https://cocoapods.org/pods/Spy)
Expand Down Expand Up @@ -47,7 +48,7 @@ github "appunite/Spy"

To install Spy using **Swift Package Manager** go through following steps:

1. Add following package dependency in you **Package.swift** ``` .package(url: "https://github.com/appunite/Spy.git", from: "0.1.0") ```
1. Add following package dependency in you **Package.swift** ``` .package(url: "https://github.com/appunite/Spy.git", from: "0.2.0") ```
2. Add following tatget dependency in your **Package.swift** ``` dependencies: ["Spy"]) ```

For instance this is how it might look like:
Expand All @@ -62,7 +63,7 @@ let package = Package(
targets: ["YourLibrary"])
],
dependencies: [
.package(url: "https://github.com/appunite/Spy.git", from: "0.1.0")
.package(url: "https://github.com/appunite/Spy.git", from: "0.2.0")
],
targets: [
.target(
Expand Down Expand Up @@ -120,15 +121,32 @@ Logging is performed with **log** method as follows:
spy.log(level: .severe, channel: .foo, message: "Something bad happened")
```

#### ConsoleSpy
ConsoleSpy comes with two available output formatters **RawSpyFormatter** and **DecoratedSpyFormatter** with the later being extendable with decorators. You can always define your own output formatter.
Example output for *RawSpyFormatter* will look like:
```
info::foo::Hello Spy
```
And example output for *DecoratedSpyFormatter* may look like:
```
ℹ️ info::foo::Hello Spy
```
<p align="center">
<img src="resources/log.png" alt="Log example"/>
</p>

## Example
This is an example definition of the spies.
It utilizes *CompositeSpy* to allow you to log onto multiple destinations (*Console* and *Network*). Please note that *ConsoleSpy* is shipped with the *Spy* and *NetworkSpy* is not.
```swift
public struct Environment {
public static var spy: AnySpy<SpyLevel, SpyChannel> = {
return CompositeSpy()
.add(spy: ConsoleSpy<SpyLevel, SpyChannel, RawSpyFormatter>(
spyFormatter: RawSpyFormatter(),
.add(spy: ConsoleSpy<SpyLevel, SpyChannel, DecoratedSpyFormatter>(
spyFormatter: DecoratedSpyFormatter(
levelNameBuilder: DecoratedLevelNameBuilder<SpyLevel>()
.add(decorator: EmojiPrefixedSpyLevelNameDecorator().toAnyDecorator())
),
timestampProvider: CurrentTimestampProvider(),
configuration: SpyConfigurationBuilder()
.add(levels: SpyLevel.levelsFrom(loggingLevel))
Expand Down
2 changes: 1 addition & 1 deletion Spy.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "Spy"
spec.version = "0.1.0"
spec.version = "0.2.0"
spec.summary = "Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift."
spec.homepage = "https://github.com/appunite/Spy"
spec.license = { :type => "MIT", :file => "LICENSE.md" }
Expand Down
Loading

0 comments on commit fb1c7f3

Please sign in to comment.