Skip to content

Commit

Permalink
Fixes for version changes
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Jan 9, 2025
1 parent 0d1f5f0 commit 150b1eb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ val collectionCompatVersion: String = "2.12.0"

val moduloadVersion: String = "1.1.7"

val rapidVersion: String = "0.2.2"
val rapidVersion: String = "0.6.0"

val catsEffectVersion: String = "3.5.7"

Expand Down Expand Up @@ -101,7 +101,7 @@ val sourceMapSettings = List(
lazy val root = project.in(file("."))
.aggregate(
core.js, core.jvm, core.native,
rapid.js, rapid.jvm, rapid.native,
rapid.jvm,
// TODO: Re-enable cats.native when cats-effect supports ScalaNative 0.5
cats.js, cats.jvm, //cats.native,
fileModule.jvm, fileModule.native,
Expand Down Expand Up @@ -148,14 +148,14 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
coverageEnabled := false
)

lazy val rapid = crossProject(JVMPlatform, JSPlatform, NativePlatform)
lazy val rapid = crossProject(JVMPlatform)
.crossType(CrossType.Full)
.settings(
name := "scribe-rapid",
crossScalaVersions := allScalaVersions,
libraryDependencies ++= Seq(
"com.outr" %%% "rapid-core" % rapidVersion,
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test,
"com.outr" %% "rapid-core" % rapidVersion,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
),
Test / publishArtifact := false
)
Expand Down
2 changes: 1 addition & 1 deletion config/src/main/scala/scribe/ScribeConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import moduload.Moduload
import profig._

object ScribeConfig extends Moduload {
implicit def rw: ReaderWriter[ScribeConfig] = ccRW
implicit def rw: RW[ScribeConfig] = RW.gen

private var _loaded: Boolean = false
def loaded: Boolean = _loaded
Expand Down
11 changes: 4 additions & 7 deletions logstash/src/main/scala/scribe/logstash/LogstashWriter.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package scribe.logstash

import cats.effect.IO
import cats.effect.unsafe.implicits.global
import cats.instances.future
import fabric.io.JsonFormatter
import fabric.rw._
import perfolation._
import rapid.Task
import scribe.LogRecord
import scribe.mdc.MDC
import scribe.output.LogOutput
Expand All @@ -23,13 +20,13 @@ case class LogstashWriter(url: URL,
private lazy val client = HttpClient.url(url).post

override def write(record: LogRecord, output: LogOutput, outputFormat: OutputFormat): Unit = {
val io = log(record) // Does nothing
val task = log(record) // Does nothing
if (!asynchronous) {
io.unsafeRunSync()
task.sync()
}
}

def log(record: LogRecord): IO[HttpResponse] = {
def log(record: LogRecord): Task[HttpResponse] = {
val l = record.timeStamp
val timestamp = s"${l.t.F}T${l.t.T}.${l.t.L}${l.t.z}"
val r: LogstashRecord = LogstashRecord(
Expand Down
4 changes: 2 additions & 2 deletions slack/src/main/scala/scribe/slack/Slack.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package scribe.slack

import cats.effect.IO
import fabric.Json
import fabric.rw._
import rapid.Task
import scribe.format._
import scribe.handler.LogHandler
import scribe.{Level, Logger}
Expand All @@ -17,7 +17,7 @@ class Slack(serviceHash: String, botName: String) {
def request(message: String,
markdown: Boolean = true,
attachments: List[Slack.Attachment] = Nil,
emojiIcon: String = ":fire:"): IO[HttpResponse] = {
emojiIcon: String = ":fire:"): Task[HttpResponse] = {
val m = SlackMessage(
text = message,
username = botName,
Expand Down
5 changes: 1 addition & 4 deletions slack/src/main/scala/scribe/slack/SlackWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import scribe.LogRecord
import scribe.output.LogOutput
import scribe.output.format.OutputFormat
import scribe.writer.Writer
import cats.effect.unsafe.implicits.global

/**
* SlackWriter is
Expand All @@ -13,10 +12,8 @@ import cats.effect.unsafe.implicits.global
* @param emojiIcon the emoji to use when sending messages
*/
class SlackWriter(slack: Slack, emojiIcon: String) extends Writer {

override def write(record: LogRecord, output: LogOutput, outputFormat: OutputFormat): Unit = slack.request(
message = output.plainText,
emojiIcon = emojiIcon
).unsafeRunAndForget()

).start()
}

0 comments on commit 150b1eb

Please sign in to comment.