Enable canonical versioned Go module consumption
Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
||||
## 仓库与操作
|
||||
|
||||
- 目标/产品边界:结构化日志库与可独立部署的采集服务。把一次请求的日志和错误码对齐到同一个 `trace_id`。不导入错误码模块。
|
||||
- 源码、资产、文档、机器契约位置:模块路径 `logging-system`。包为 `logsys`、`sink`、`redact`、`config`、`slogadapter`、`server`、`cli`、`conformance`、`examples/trace`。配置示例在 `docs/example.json`。
|
||||
- 源码、资产、文档、机器契约位置:模块路径 `git-ssh.u1680832.nyat.app/weichen/Logging-System.git`。包为 `logsys`、`sink`、`redact`、`config`、`slogadapter`、`server`、`cli`、`conformance`、`examples/trace`。配置示例在 `docs/example.json`。
|
||||
- 权威远端、集成基线、受保护分支:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Logging-System.git`,基线 `main`。
|
||||
- 并行共同基线记录位置、合入通知/主动检查方式:Gitea Issue/PR。消费方用自己的 gitlink 固定版本。
|
||||
- 发布线与批准版本/实际制品查询入口:无独立制品库。`go build -o bin/logctl .` 从当前提交构建。
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
跨系统共用的结构化日志库,以及可独立部署的采集服务。目标是把一次请求的运行日志和错误码对齐到同一个 `trace_id` 上,方便事后追溯。
|
||||
|
||||
本仓库是该模块的源码位置。Go 模块路径为 `logging-system`。只依赖标准库,不依赖错误码模块:只要错误实现了 `ErrorCode()` 和 `ErrorFields()`,错误日志会自动带上码和字段。
|
||||
本仓库是该模块的源码位置。Go 模块路径为 `git-ssh.u1680832.nyat.app/weichen/Logging-System.git`。只依赖标准库,不依赖错误码模块:只要错误实现了 `ErrorCode()` 和 `ErrorFields()`,错误日志会自动带上码和字段。
|
||||
|
||||
## 分层
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"logging-system/server"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/server"
|
||||
)
|
||||
|
||||
// Main 执行命令行并返回退出码。
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"logging-system/server"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/server"
|
||||
)
|
||||
|
||||
func TestQueryCommand(t *testing.T) {
|
||||
|
||||
+3
-3
@@ -8,9 +8,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"logging-system/logsys"
|
||||
"logging-system/redact"
|
||||
"logging-system/sink"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/redact"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/sink"
|
||||
)
|
||||
|
||||
// Config 是日志系统的全部可配置项。
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"logging-system/logsys"
|
||||
"logging-system/sink"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/sink"
|
||||
)
|
||||
|
||||
func TestLoadEnvOverridesFile(t *testing.T) {
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"logging-system/logsys"
|
||||
"logging-system/redact"
|
||||
"logging-system/sink"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/redact"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/sink"
|
||||
)
|
||||
|
||||
func TestSyncConcurrentNoLoss(t *testing.T) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
module logging-system/examples/trace
|
||||
module git-ssh.u1680832.nyat.app/weichen/Logging-System.git/examples/trace
|
||||
|
||||
go 1.27
|
||||
|
||||
require (
|
||||
error-code-system v0.0.0
|
||||
logging-system v0.0.0
|
||||
git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git v0.0.0
|
||||
git-ssh.u1680832.nyat.app/weichen/Logging-System.git v0.0.0
|
||||
)
|
||||
|
||||
replace error-code-system => ../../../Error-Code-System
|
||||
replace git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git => ../../../Error-Code-System
|
||||
|
||||
replace logging-system => ../..
|
||||
replace git-ssh.u1680832.nyat.app/weichen/Logging-System.git => ../..
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"error-code-system/domains"
|
||||
"error-code-system/errcode"
|
||||
"error-code-system/httpx"
|
||||
"logging-system/logsys"
|
||||
"logging-system/sink"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/domains"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/errcode"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/httpx"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/sink"
|
||||
)
|
||||
|
||||
func TestErrorCodeReachesLogAndHTTP(t *testing.T) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module logging-system
|
||||
module git-ssh.u1680832.nyat.app/weichen/Logging-System.git
|
||||
|
||||
go 1.27
|
||||
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"os"
|
||||
|
||||
"logging-system/cli"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"logging-system/logsys"
|
||||
"logging-system/redact"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/redact"
|
||||
)
|
||||
|
||||
// DefaultAddr 是 logcollector 的默认监听地址。
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"logging-system/logsys"
|
||||
"logging-system/redact"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/redact"
|
||||
)
|
||||
|
||||
// Record 是带序号的日志,序号即查询游标。
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// ErrClosed 表示出口已经关闭。
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// Console 把日志写到 io.Writer。Format 为 human 或 json,空值按 human。
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package sink
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// Fanout 把同一条日志写到多个出口。单个出口失败不影响其他出口。
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// File 以互斥锁保护的方式追加日志,可选按大小滚动。
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// HTTPBatch 把日志攒批 POST 到采集器。Async 为 false 时在 Write 里同步发送。
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package sink
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// Memory 把日志留在内存里,供测试和进程内订阅前的缓冲。
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
func entry(i int) logsys.Entry {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"log/slog"
|
||||
|
||||
"logging-system/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
)
|
||||
|
||||
// Handler 把 slog 记录写入 logsys。
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"logging-system/logsys"
|
||||
"logging-system/sink"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/logsys"
|
||||
"git-ssh.u1680832.nyat.app/weichen/Logging-System.git/sink"
|
||||
)
|
||||
|
||||
func TestSlogToLogsys(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user