mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-10-13 01:35:27 +02:00
- Add logger to all exporters for consistent error handling - Add Course.Validate() method with ValidationError type - Create shared test fixtures in internal/testdata - Refactor config passing: NewArticulateParser now takes *config.Config - Add NewLoggerFromConfig() factory for logger creation - Add context cancellation with signal handling (SIGINT/SIGTERM) - Add godoc examples for loggers and exporters - Add HTML exporter error path tests - Add fuzz tests for parser and HTMLCleaner - Fix markdown output: trim whitespace, collapse blank lines - Remove test output files from repo
16 lines
471 B
Go
16 lines
471 B
Go
package services
|
|
|
|
import (
|
|
"github.com/kjanat/articulate-parser/internal/config"
|
|
"github.com/kjanat/articulate-parser/internal/interfaces"
|
|
)
|
|
|
|
// NewLoggerFromConfig creates a logger based on the configuration.
|
|
// Returns a JSON logger if cfg.LogFormat is "json", otherwise returns a text logger.
|
|
func NewLoggerFromConfig(cfg *config.Config) interfaces.Logger {
|
|
if cfg.LogFormat == "json" {
|
|
return NewSlogLogger(cfg.LogLevel)
|
|
}
|
|
return NewTextLogger(cfg.LogLevel)
|
|
}
|