Files
agent-evals/backend/pkg/logger/logger.go
Evan Reichard 5b67cb61d2 feat(markdown-editor): implement wysiswyg markdown editor with live preview
- Build Go backend with Cobra CLI and REST API
  - CRUD operations for markdown files (GET, POST, PUT, DELETE)
  - File storage with flat .md file structure
  - Comprehensive logrus logging with JSON format
  - Static asset serving for frontend

- Build React/TypeScript frontend with Tailwind CSS
  - Markdown editor with live GFM preview
  - File management UI (list, create, open, delete)
  - Theme system (Dark/Light/System) with persistence
  - Responsive design (320px mobile, 1920px desktop)

- Add comprehensive test coverage
  - Backend: API, storage, and logger tests (13 tests passing)
  - Frontend: Editor and App component tests

- Setup Nix development environment with Go, Node.js, and TypeScript
2026-02-05 17:48:23 -05:00

85 lines
1.5 KiB
Go

package logger
import (
"os"
"github.com/sirupsen/logrus"
)
var (
log *logrus.Logger
)
func Init() {
log = logrus.New()
log.SetOutput(os.Stdout)
log.SetFormatter(&logrus.JSONFormatter{
TimestampFormat: "2006-01-02 15:04:05",
})
log.SetLevel(logrus.InfoLevel)
}
func Info(msg string, fields ...interface{}) {
if len(fields) > 0 {
log.WithFields(logrus.Fields{"message": msg}).Info()
} else {
log.Info(msg)
}
}
func Infof(format string, args ...interface{}) {
log.Infof(format, args...)
}
func Debug(msg string, fields ...interface{}) {
if len(fields) > 0 {
log.WithFields(logrus.Fields{"message": msg}).Debug()
} else {
log.Debug(msg)
}
}
func Debugf(format string, args ...interface{}) {
log.Debugf(format, args...)
}
func Warn(msg string, fields ...interface{}) {
if len(fields) > 0 {
log.WithFields(logrus.Fields{"message": msg}).Warn()
} else {
log.Warn(msg)
}
}
func Warnf(format string, args ...interface{}) {
log.Warnf(format, args...)
}
func Error(msg string, fields ...interface{}) {
if len(fields) > 0 {
log.WithFields(logrus.Fields{"message": msg}).Error()
} else {
log.Error(msg)
}
}
func Errorf(format string, args ...interface{}) {
log.Errorf(format, args...)
}
func Fatal(msg string, fields ...interface{}) {
if len(fields) > 0 {
log.WithFields(logrus.Fields{"message": msg}).Fatal()
} else {
log.Fatal(msg)
}
}
func Fatalf(format string, args ...interface{}) {
log.Fatalf(format, args...)
}
func WithField(key string, value interface{}) *logrus.Entry {
return log.WithField(key, value)
}