Skip to content

feat: add JSON structured log target#6

Merged
devfeel merged 9 commits intomasterfrom
develop
Mar 16, 2026
Merged

feat: add JSON structured log target#6
devfeel merged 9 commits intomasterfrom
develop

Conversation

@devfeel
Copy link
Owner

@devfeel devfeel commented Mar 16, 2026

feat: add JSON structured log target

  • Add JSONTarget for structured logging
  • Support file/stdout/stderr output with prettyPrint option
  • Fix compilation errors in innerlogger.go and layout.go
  • Resolve all lint warnings
  • Bump version to 0.10

root and others added 9 commits March 14, 2026 15:32
- Add go.mod for Go modules dependency management
- Add GitHub Actions workflow (test + lint)
- Add YAML configuration parser with full test coverage
- Add config.yaml example file

Co-authored-by: 小源 <ai@devfeel.com>
- Add JSON target support (targets/target_json.go)
- Add JSON config structure (config/json.go)
- Add JSON config tests (config/json_test.go)
- Update const.go with TargetType_JSON
- Update yaml.go to support JSON target

Co-authored-by: 小源 <ai@devfeel.com>
- innerlogger.go: fmt.Sprint(content) -> fmt.Sprint(content...)
- This fixes the build error: missing ... in args forwarded to print-like function
- layout/layout.go: string(ch) -> strconv.Itoa(ch) to fix build error
  'conversion from int to string yields a string of one rune'
- internal/innerlogger.go: fmt.Sprint(content) -> fmt.Sprint(content...)
- targets/target_file.go: pathExists == false -> pathExists
- internal/innerlogger.go: pathExists == false -> pathExists
- layout/layout.go: remove unused fields isEnd, val
- targets/target_file.go: check WriteString error
- internal/innerlogger.go: check WriteString error
- example/normal/main.go: check StartLogService error
- util/convert/convert.go: check binary.Read error
- util/email/email.go: remove unnecessary fmt.Sprintf
- targets/target_file.go: move defer after error check
- internal/innerlogger.go: move defer after error check
- targets/target_udp.go: move defer after error check
- layout/layout.go: remove unnecessary buf assignment
- logger.go: use ok variable to check map key existence
feat: add JSON structured log target
feat: add JSON structured log target
@devfeel devfeel merged commit dc120d6 into master Mar 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant