(wip) reorganizing, rendering still a pain in the butt
This commit is contained in:
		
							parent
							
								
									6999f02da0
								
							
						
					
					
						commit
						c1e7e594e8
					
				
					 12 changed files with 52 additions and 39 deletions
				
			
		
							
								
								
									
										37
									
								
								build.sbt
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								build.sbt
									
										
									
									
									
								
							|  | @ -20,9 +20,28 @@ val sharedSettings = Seq( | |||
|   /* coverageMinimumStmtTotal := 100, coverageMinimumBranchTotal := 100 */ | ||||
| ) | ||||
| 
 | ||||
| val Deps = new { | ||||
|   val Cats = new { | ||||
|     val Core: ModuleID   = "org.typelevel" %% "cats-core"   % "2.10.0" | ||||
|     val Effect: ModuleID = "org.typelevel" %% "cats-effect" % "3.5.4" | ||||
|   } | ||||
| 
 | ||||
|   val Fs2 = new { | ||||
|     val Core: ModuleID = "co.fs2" %% "fs2-core" % "3.10.2" | ||||
|   } | ||||
| 
 | ||||
|   val Gs = new { | ||||
|     val Uuid: ModuleID = "gs" %% "gs-uuid-v0" % "0.2.3" | ||||
|     val Datagen: ModuleID = "gs" %% "gs-datagen-core-v0" % "0.1.1" | ||||
|   } | ||||
| 
 | ||||
|   val MUnit: ModuleID = "org.scalameta" %% "munit" % "1.0.0-M12" | ||||
| } | ||||
| 
 | ||||
| lazy val testSettings = Seq( | ||||
|   libraryDependencies ++= Seq( | ||||
|     "org.scalameta" %% "munit" % "1.0.0-M12" % Test | ||||
|     Deps.MUnit % Test, | ||||
|     Deps.Gs.Datagen % Test | ||||
|   ) | ||||
| ) | ||||
| 
 | ||||
|  | @ -32,17 +51,15 @@ lazy val `gs-log` = project | |||
|   .settings(noPublishSettings) | ||||
|   .settings(name := s"${gsProjectName.value}-v${semVerMajor.value}") | ||||
| 
 | ||||
| /** This project contains the logging API and core data types required to use | ||||
|   * `gs-log`. It does not provide an engine. This project can be used within | ||||
|   * libraries, for example, or in conjunction with an engine. | ||||
|   */ | ||||
| lazy val data = project | ||||
|   .in(file("modules/data")) | ||||
|   .settings(sharedSettings) | ||||
|   .settings(testSettings) | ||||
|   .settings(name := s"${gsProjectName.value}-data-v${semVerMajor.value}") | ||||
| 
 | ||||
| lazy val api = project | ||||
|   .in(file("modules/api")) | ||||
|   .dependsOn(data) | ||||
|   .settings(sharedSettings) | ||||
|   .settings(testSettings) | ||||
|   .settings(name := s"${gsProjectName.value}-api-v${semVerMajor.value}") | ||||
|   .settings( | ||||
|     libraryDependencies ++= Seq( | ||||
|       "gs" %% "gs-uuid-v0" % "0.2.3" | ||||
|     ) | ||||
|   ) | ||||
|  |  | |||
|  | @ -1,16 +0,0 @@ | |||
| package gs.log.v0 | ||||
| 
 | ||||
| import gs.uuid.v0.UUID | ||||
| 
 | ||||
| /** Trace information for logger output. Based on OpenTelemetry distributed | ||||
|   * traces. | ||||
|   * | ||||
|   * @param traceId | ||||
|   *   The unique identifier of the distributed trace. This is a 128-bit UUID. | ||||
|   * @param spanId | ||||
|   *   The unique identifier of the current span. This is a 64-bit value. | ||||
|   */ | ||||
| case class LogTrace( | ||||
|   traceId: UUID, | ||||
|   spanId: Long | ||||
| ) | ||||
|  | @ -1,4 +1,7 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.api | ||||
| 
 | ||||
| import gs.log.v0.data.LogData | ||||
| import gs.log.v0.data.LogMessage | ||||
| 
 | ||||
| import java.time.Instant | ||||
| import scala.collection.mutable.{Map => MutMap} | ||||
|  | @ -148,13 +151,11 @@ object Log: | |||
|     *   The instant the [[Log]] was _submitted_. | ||||
|     * @param owner | ||||
|     *   The name of the [[Logger]] which submitted the log. | ||||
|     * @param trace Optional [[LogTrace]] for a specific call. | ||||
|     */ | ||||
|   case class Metadata( | ||||
|     level: LogLevel, | ||||
|     timestamp: Instant, | ||||
|     owner: Logger.Name, | ||||
|     trace: Option[LogTrace] | ||||
|     owner: Logger.Name | ||||
|   ) | ||||
| 
 | ||||
| end Log | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.api | ||||
| 
 | ||||
| /** Enumerates all supported log levels, which control logging verbosity. | ||||
|   * | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.api | ||||
| 
 | ||||
| /** | ||||
|   * Interface for emitting logs. This and [[Log]] are the primary types that | ||||
|  | @ -1,4 +1,7 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.syntax | ||||
| 
 | ||||
| import gs.log.v0.data.LogMessage | ||||
| import gs.log.v0.data.LogData | ||||
| 
 | ||||
| private object LogMessageBuilder extends LogMessage.Builder | ||||
| private object LogDataSyntax     extends LogData.Syntax | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.data | ||||
| 
 | ||||
| import scala.reflect.ClassTag | ||||
| import java.time.LocalDate | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.data | ||||
| 
 | ||||
| import java.time.LocalDate | ||||
| 
 | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.data | ||||
| 
 | ||||
| /** Opaque type (String) for representing messages that should be logged. This | ||||
|   * type can _only_ be instantiated using the `log` string interpolator, which | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.data | ||||
| 
 | ||||
| /** Default tag definitions. Tags are arbitrary strings attached to logs in the | ||||
|   * `tags` field. They can be used to describe what is being logged. | ||||
|  | @ -1,4 +1,4 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.data | ||||
| 
 | ||||
| import java.time.Instant | ||||
| import java.time.LocalDate | ||||
|  | @ -1,7 +1,9 @@ | |||
| package gs.log.v0 | ||||
| package gs.log.v0.data | ||||
| 
 | ||||
| class LogMessageTests extends munit.FunSuite: | ||||
| 
 | ||||
|   import LogMessageTests.Syntax.* | ||||
| 
 | ||||
|   test("should instantiate a log message from a string literal") { | ||||
|     val msg = log"1 2 3 4" | ||||
|     assert(msg.str() == "1 2 3 4") | ||||
|  | @ -23,3 +25,9 @@ class LogMessageTests extends munit.FunSuite: | |||
|     val expected        = s"x = ${x.value.renderBytes()}, y = ${y.value.renderBytes()}" | ||||
|     assert(msg.str() == expected) | ||||
|   } | ||||
| 
 | ||||
| object LogMessageTests: | ||||
| 
 | ||||
|   private object Syntax extends LogMessage.Builder | ||||
| 
 | ||||
| end LogMessageTests | ||||
		Loading…
	
	Add table
		
		Reference in a new issue