Skip to content

Commit

Permalink
Merge pull request #8 from appunite/0.0.4
Browse files Browse the repository at this point in the history
0.0.4
  • Loading branch information
lewandowskit93 authored Jan 24, 2020
2 parents f223b80 + 50e32ca commit e90aec6
Show file tree
Hide file tree
Showing 28 changed files with 1,090 additions and 209 deletions.
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ excluded:
- fastlane/
- tools/
- vendor/
- sourcery/
- SpyTests/Autogenerated/*.swift
reporter: "xcode"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.4]
- Add carthage support
- Boost code coverage

## [0.0.3]
- Fixed version to 0.0.3

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.0.3
PRODUCT_VERSION = 0.0.4
SWIFT_VERSION = 5.0
CODE_SIGN_STYLE = Manual

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ bundler:
generate:
@xcodegen generate
@bundle exec pod install
@make sourcery

sourcery: auto-mocks

auto-mocks:
@$(SOURCERY) --config sourcery/AutoMockable.sourcery.yml --disableCache

define brew_install
@echo "--- Installing $(1)..."
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ target 'Spy_macOS' do
target 'SpyTests' do
# Pods for testing
inherit! :search_paths
pod 'Sourcery'
end

end
6 changes: 5 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
PODS:
- Sourcery (0.17.0)
- SwiftLint (0.38.2)

DEPENDENCIES:
- Sourcery
- SwiftLint

SPEC REPOS:
trunk:
- Sourcery
- SwiftLint

SPEC CHECKSUMS:
Sourcery: 3ed61be7c8a1218fce349266139379dba477efe0
SwiftLint: 8f5d2f903e1c9bcbc832fd16771e80a263ac6cbb

PODFILE CHECKSUM: 3a6b6eaa3f7778020eaeed22520da690f8612aae
PODFILE CHECKSUM: 8a7ec5bf9bdbc12b85d4e5d30878fd4da0887ad4

COCOAPODS: 1.8.4
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Spy is a lightweight, multiplatform logging utility written in pure Swift. It allows to log with different levels and on different channels. You can define what levels and channels actually are.
Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift. It allows to log with different levels and on different channels. You can define what levels and channels actually are.

## Requirements

Expand All @@ -7,6 +7,7 @@ Project uses following tools for development
1. XCodeGen
2. Cocoapods
3. SwiftLint
4. Sourcery

## Installation

Expand Down Expand Up @@ -39,7 +40,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.0.3") ```
1. Add following package dependency in you **Package.swift** ``` .package(url: "https://github.com/appunite/Spy.git", from: "0.0.4") ```
2. Add following tatget dependency in your **Package.swift** ``` dependencies: ["Spy"]) ```

## Overview
Expand All @@ -48,8 +49,7 @@ Here is a quick overview of functionalities and concepts used in **Spy**.

### SpyChannel

SpyChannel is anything that implements *PSpyChannel* protocol. Channels can be used to categorize logs. You define
Typically they are implemented with an enum e.g.:
SpyChannel is anything that implements *PSpyChannel* protocol. Channels can be used to categorize logs. Typically they are implemented with an enum. You can define your own channels as follows:
```swift
public enum SpyChannel: String, PSpyChannel {
case foo
Expand All @@ -62,14 +62,14 @@ public enum SpyChannel: String, PSpyChannel {
```

### SpyLevel
SpyLevel is anything that implements *PSpyLevel* protocol. You can define your own levels, but Spy commes with one set defined for you. This set is called *SpyLevel* and contains following levels: *finest, finer, fine, config, info, warning, severe* sorted by the increasing alert priority.
SpyLevel is anything that implements *PSpyLevel* protocol. You can define your own levels, but Spy commes with one set defined for you so you can use it if you want. This set is called *SpyLevel* and contains following alert levels: *finest, finer, fine, config, info, warning, severe* sorted by the increasing alert priority.

### SpyConfiguration
Contains levels and channels that the Spy will spy on.

### SpyConfigurationBuilder
Builds your spy configuration by providing add and remove functions for both levels and channels.
Example usage
Example usage:
```swift
SpyConfigurationBuilder()
.add(level: .severe)
Expand All @@ -81,19 +81,19 @@ SpyConfigurationBuilder()
Spyable is a entity that can be logged. It has to implement *PSpyable* protocol. You can define your own spyables or use string as a basic one.

### Spy
Spy is anything that implements *PSpy* protocol. There a few spies defined for you:
- *ConsoleSpy* - spy that logs by using print command
Spy is anything that implements *PSpy* protocol. There are a few spies already defined for you:
- *ConsoleSpy* - spy that logs spyables by using print command
- *CompositeSpy* - spy that groups multiple spies into one
- *AnySpy* - type-erased spy, every spy can be converted to AnySpy
- *AnySpy* - type-erased spy - every spy can be converted to AnySpy

Logging is performed with *log* method as follows
Logging is performed with **log** method as follows:
```swift
spy.log(level: .severe, channel: .foo, message: "Something bad happened")
```

## Example
This is an example definition of the spies.
It utilizes *CompositeSpy* to allow to log onto multiple destinations (*Console* and *Network*). Please note that *ConsoleSpy* is shipped with the *Spy* and *NetworkSpy* is not.
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> = {
Expand All @@ -114,7 +114,7 @@ public struct Environment {
}()
}
```
By using preprocessor we can define different logging levels for debug and release. That way we won't forget about switching off unimportant logs.
By using preprocessor we can define different logging levels for debug and release. That way we won't forget about switching off unimportant logs before release.
```swift
public extension Environment {
static var loggingLevel: SpyLevel {
Expand All @@ -127,18 +127,18 @@ public extension Environment {
}
```

And here is how you use Spy:
And here is how you could use Spy:
```swift
Environment.spy.log(level: .info, channel: .foo, message: "initialized")
```

For more detailed example please see source code.
For more detailed example please see the source code.

## Contribution

Project is created by **Tomasz Lewandowski**.
Project is created and maintained by **Tomasz Lewandowski**.

If you created some new feature or fixed a bug you can create a pull request. Feel free to submit your feature requests if you have any.
If you created some new feature or fixed a bug you can create a pull request. Please feel free to submit your feature requests if you have any.

## License

Expand Down
4 changes: 2 additions & 2 deletions Spy.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |spec|
spec.name = "Spy"
spec.version = "0.0.3"
spec.summary = "Spy is a lightweight, multiplatform logging utility written in pure Swift."
spec.version = "0.0.4"
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" }
spec.author = { "Tomasz Lewandowski" => "tomasz.t.lewandowski@gmail.com" }
Expand Down
Loading

0 comments on commit e90aec6

Please sign in to comment.