package logger

import (
	"context"
)

type Interface interface {
	Trace(context.Context, string, ...interface{})
}

// Writer log writer interface
type Writer interface {
	Printf(string, ...interface{})
}

type log struct {
	Writer
	config Config
}

func (l *log) Trace(ctx context.Context, s string, i ...interface{}) {
	if l.config.Open {
		l.Printf("[SPARROW-SDK]"+s, i)
	}
}

type Config struct {
	Open bool
}

func New(writer Writer, config Config) Interface {
	return &log{
		Writer: writer,
		config: config,
	}
}
