Skip to content

Commit

Permalink
Merge pull request #9 from gvolpe/feature/scribe-logging
Browse files Browse the repository at this point in the history
First release
  • Loading branch information
gvolpe authored Jul 23, 2018
2 parents a432d42 + 15b489d commit 593bb05
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fs2-redis
=========

[![Build Status](https://travis-ci.org/gvolpe/fs2-redis.svg?branch=master)](https://travis-ci.org/gvolpe/fs2-redis)
[![codecov](https://codecov.io/gh/gvolpe/fs2-redis/branch/master/graph/badge.svg)](https://codecov.io/gh/gvolpe/fs2-redis)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.gvolpe/fs2-redis_2.12.svg)](http://search.maven.org/#search%7Cga%7C1%7Cfs2-redis)

Stream-based client built on top of [Fs2](https://functional-streams-for-scala.github.io/fs2/) and the async java client [Lettuce](https://lettuce.io/).

Expand Down
22 changes: 6 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ name := """fs2-redis-root"""

organization in ThisBuild := "com.github.gvolpe"

version in ThisBuild := "0.1-SNAPSHOT"
version in ThisBuild := "0.1.0"

crossScalaVersions in ThisBuild := Seq("2.12.6")
crossScalaVersions in ThisBuild := Seq("2.12.4")

sonatypeProfileName := "com.github.gvolpe"

Expand All @@ -23,12 +23,13 @@ val commonSettings = Seq(
startYear := Some(2018),
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/gvolpe/fs2-redis")),
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.5" cross CrossVersion.binary),
libraryDependencies ++= Seq(
compilerPlugin(Libraries.kindProjector cross CrossVersion.binary),
compilerPlugin(Libraries.betterMonadicFor),
Libraries.redisClient,
Libraries.catsEffect,
Libraries.fs2Core,
Libraries.slf4j,
Libraries.scribe,
Libraries.scalaTest,
Libraries.scalaCheck
),
Expand All @@ -44,7 +45,6 @@ val commonSettings = Seq(
"-language:higherKinds"
),
scalafmtOnCompile := true,
//coverageExcludedPackages := "com\\.github\\.gvolpe\\.fs2rabbit\\.examples.*;com\\.github\\.gvolpe\\.fs2rabbit\\.util.*;.*QueueName*;.*RoutingKey*;.*ExchangeName*;.*DeliveryTag*;.*AMQPClientStream*;.*ConnectionStream*;",
publishTo := {
val sonatype = "https://oss.sonatype.org/"
if (isSnapshot.value)
Expand All @@ -65,14 +65,6 @@ val commonSettings = Seq(
</developers>
)

val CoreDependencies: Seq[ModuleID] = Seq(
Libraries.logback % "test"
)

val ExamplesDependencies: Seq[ModuleID] = Seq(
Libraries.logback % "runtime"
)

lazy val noPublish = Seq(
publish := {},
publishLocal := {},
Expand All @@ -86,13 +78,11 @@ lazy val `fs2-redis-root` = project.in(file("."))

lazy val `fs2-redis` = project.in(file("core"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= CoreDependencies)
.settings(parallelExecution in Test := false)
.enablePlugins(AutomateHeaderPlugin)

lazy val examples = project.in(file("examples"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= ExamplesDependencies)
.settings(noPublish)
.enablePlugins(AutomateHeaderPlugin)
.dependsOn(`fs2-redis`)
Expand Down Expand Up @@ -131,4 +121,4 @@ lazy val microsite = project.in(file("site"))
.dependsOn(`fs2-redis`, `examples`)

// CI build
addCommandAlias("buildFs2Redis", ";clean;+coverage;+test;+coverageReport;+coverageAggregate;tut")
addCommandAlias("buildFs2Redis", ";clean;+test;tut")
8 changes: 3 additions & 5 deletions core/src/main/scala/com/github/gvolpe/fs2redis/util/Log.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@
package com.github.gvolpe.fs2redis.util

import cats.effect.Sync
import cats.syntax.flatMap._
import org.slf4j.LoggerFactory

trait Log[F[_]] {
def info(value: String): F[Unit]
def error(error: Throwable): F[Unit]
}

object Log {
private[fs2redis] def logger[F[_]: Sync] = Sync[F].delay { LoggerFactory.getLogger(this.getClass) }
def apply[F[_]: Sync](implicit ev: Log[F]): Log[F] = ev

implicit def syncLogInstance[F[_]](implicit F: Sync[F]): Log[F] =
new Log[F] {
override def error(error: Throwable): F[Unit] = logger[F].flatMap(l => F.delay(l.error(error.getMessage, error)))
override def info(value: String): F[Unit] = logger[F].flatMap(l => F.delay(l.info(value)))
override def error(error: Throwable): F[Unit] = F.delay(scribe.error(error.getMessage, error))
override def info(value: String): F[Unit] = F.delay(scribe.info(value))
}
}
14 changes: 0 additions & 14 deletions examples/src/main/resources/logback.xml

This file was deleted.

11 changes: 7 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ object Dependencies {
val catsEffect = "1.0.0-RC2"
val fs2 = "1.0.0-M1"
val lettuce = "5.1.0.M1"
val scribe = "2.3.0"

val slf4j = "1.7.25"
val logback = "1.1.3"
val betterMonadicFor = "0.2.4"
val kindProjector = "0.9.7"

val scalaTest = "3.0.1"
val scalaCheck = "1.13.4"
Expand All @@ -18,9 +19,11 @@ object Dependencies {
lazy val redisClient = "io.lettuce" % "lettuce-core" % Versions.lettuce
lazy val catsEffect = "org.typelevel" %% "cats-effect" % Versions.catsEffect
lazy val fs2Core = "co.fs2" %% "fs2-core" % Versions.fs2
lazy val scribe = "com.outr" %% "scribe" % Versions.scribe

lazy val slf4j = "org.slf4j" % "slf4j-api" % Versions.slf4j
lazy val logback = "ch.qos.logback" % "logback-classic" % Versions.logback
// Compiler plugins
lazy val betterMonadicFor = "com.olegpy" %% "better-monadic-for" % Versions.betterMonadicFor
lazy val kindProjector = "org.spire-math" %% "kind-projector" % Versions.kindProjector

// Scala test libraries
lazy val scalaTest = "org.scalatest" %% "scalatest" % Versions.scalaTest % "test"
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.1.4
sbt.version=1.1.6
6 changes: 1 addition & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
resolvers += Classpaths.sbtPluginReleases
resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.2")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
Expand All @@ -13,6 +9,6 @@ addSbtPlugin("de.heikoseeberger" % "sbt-header" % "4.0.0")

addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")

addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.16")
addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.20")

addSbtPlugin("com.scalapenos" % "sbt-prompt" % "1.0.2")

0 comments on commit 593bb05

Please sign in to comment.