scala-logging
923
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
Scala
语言
—
创建时间
最近更新
项目能做什么
scala-logging 是一个封装了 SLF4J 的高性能 Scala 日志库。它利用 Scala 宏(Macros)在编译期自动生成日志级别检查代码,避免了手动写 `isDebugEnabled` 的繁琐和高昂的字符串插值开销;同时提供 `LazyLogging` 等特质,开箱即用、便捷高效。
来源:基于仓库元数据
· 内容以仓库实际 README 为准
使用说明 查看原始 README 原仓库文档
中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
Scala Logging is a **convenient** and **fast** logging library wrapping [SLF4J](http://www.slf4j.org).
![CI][Badge-CI] [![Version][Badge-Releases]][Link-Releases]
[Badge-CI]: https://github.com/lightbend-labs/scala-logging/actions/workflows/ci.yml/badge.svg
[Badge-Releases]: https://img.shields.io/maven-central/v/com.typesafe.scala-logging/scala-logging_3
[Link-Releases]: https://repo1.maven.org/maven2/com/typesafe/scala-logging/scala-logging_3/
It's convenient, because you can simply call log methods, *without* checking whether the respective log level is enabled:
```scala
logger.debug(s"Some $expensive message!")
```
It's fast, because thanks to Scala macros the *check-enabled-idiom* is applied and the following code is generated:
```scala
if (logger.isDebugEnabled) logger.debug(s"Some $expensive message!")
```
## Prerequisites
* Java 11 or higher
* Scala Logging 3.x supports Java 8
* Scala 2.12, 2.13 or 3.0
* Logging backend compatible with SLF4J
A compatible logging backend is [Logback](http://logback.qos.ch), add it to your sbt build definition:
```scala
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.4.14"
```
If you are looking for a version compatible with Scala 2.10, check out Scala Logging 2.x.
**If you are looking for a version compatible with SLF4J 1.x, check out Scala Logging 3.x.**
## Getting Scala Logging
Scala Logging is published to Sonatype OSS and Maven Central:
- Group id / organization: *com.typesafe.scala-logging*
- Artifact id / name: *scala-logging*
sbt users may add this to their `build.sbt`:
```scala
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "4.0.0-RC1"
```
## Using Scala Logging
The `Logger` class from the `com.typesafe.scalalogging` package wraps an underlying SLF4J logger.
In order to create a `Logger`, you pass a name to the `apply` factory method defined in the `Logger` companion object:
```scala
val logger = Logger("name")
```
Or, you pass in a SLF4J logger instance:
```scala
val logger = Logger(LoggerFactory.getLogger("name"))
```
Or, you pass in the name of the class into which it is defined:
```scala
val logger = Logger(getClass.getName)
```
Or, you pass in a class:
```scala
val logger = Logger(classOf[MyClass])
```
Or, using the runtime class wrapped by the implicit class tag parameter:
```scala
val logger = Logger[MyClass]
```
The `LazyLogging` and `StrictLogging` traits from the `com.typesafe.scalalogging` package define the `logger` member as
a lazy or strict value respectively, whereas the `AnyLogging` trait defines an abstract `logger`.
It depends on the individual use case which trait to use. However, we have defined some scenarios where you can use these traits:
- Use `LazyLogging` if you are creating lots of objects with this trait repetitively.
- Use `StrictLogging` pretty much by default, especially if the class is a singleton, or you know the log methods will always be invoked.
- Use `AnyLogging` when writing some trait
阅读完整原文
项目深度分析 规则生成(AI 未配置)
综合评分 55.4 分。该项目在“个人可实施性”维度得 30 分,“付费可能性”维度得 40.0 分,差异化空间 100.0 分(评分依据见评分卡)。
将 scala-logging 改造为垂直场景 SaaS
| 产品构想 | 保留核心能力,针对某一类用户(如某行业团队)做托管版,收取月费。 |
| 目标用户 | 有该需求的中小团队 / 独立站长 |
| 难度/周期 | 较高 · 2~4 周(MVP) |
| 收费模式 | 订阅制(如 ¥29~99/月) |
| 竞争风险 | 需验证付费意愿;注意许可证合规 |
| 依据 | 数据支持的判断:许可证与关键词显示存在商用与付费场景 |
面向细分需求的二次开发产品
| 产品构想 | 基于 scala-logging 的核心能力,聚焦一个更窄的场景(如某平台、某行业)做差异化。 |
| 目标用户 | 该细分场景用户 |
| 难度/周期 | 中 · 2~6 周 |
| 收费模式 | 买断制 / 订阅制 / 广告 |
| 竞争风险 | 细分需求规模需验证 |
| 依据 | AI 推测:基于项目主题标签的判断 |
以上为规则引擎基于仓库公开数据生成的参考结论,包含推测成分,不构成投资或创业承诺;配置 AI 后可获得更深入的分析。
报告会保存到 个人中心
竞品与相似项目 GitHub Search 真实检索
相似项目数据正在完善中,暂不展示(避免误导)
项目优势与风险
| 技术成熟度 | 创建时间待补全,最近推送 ,发布过 8 个 Release |
| 社区活跃 | Star 923 / Fork 0 / Issue 0(数据支持,可自行核实) |
| 许可证 | 未检测到(需人工确认) |
| 主要风险 | 上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价 |
安装与使用
此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。