<commit_before>package goarmorlogs

import (
	"fmt"

	"github.com/armor5games/goarmor/goarmorapi"
	"github.com/sirupsen/logrus"
)

type DummyHealth struct {
	Logger *logrus.Logger `json:"logger"`
}

func NewDummyHealth(l *logrus.Logger) *DummyHealth {
	return &DummyHealth{Logger: l}
}

func (l *DummyHealth) Event(eventName string) {
	l.Logger.Debug(eventName)
}

func (l *DummyHealth) EventKv(eventName string, kvs map[string]string) {
	l.Logger.WithFields(dummyHealthKVToLogrusFields(kvs)).Debug(eventName)
}

func (l *DummyHealth) EventErr(eventName string, err error) error {
	err = fmt.Errorf("%s %s", eventName, err.Error())
	l.Logger.Error(err.Error())
	return err
}

func (l *DummyHealth) EventErrKv(eventName string, err error, kvs map[string]string) error {
	logrusKV := dummyHealthKVToLogrusFields(kvs)
	goarmorapiKV := goarmorapi.KV(logrusKV)

	err = fmt.Errorf("%s %s", eventName, err.Error())
	l.Logger.WithFields(logrusKV).Error(err.Error())

	return fmt.Errorf("%s %s", err.Error(), goarmorapiKV.String())
}
<commit_msg>minor<commit_after>package goarmorlogs

import (
	"fmt"

	"github.com/armor5games/goarmor/goarmorapi"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)

type DummyHealth struct {
	Logger *logrus.Logger `json:"logger"`
}

func NewDummyHealth(l *logrus.Logger) (*DummyHealth, error) {
	if l == nil {
		return nil, errors.New("nil pointer")
	}

	return &DummyHealth{Logger: l}, nil
}

func (l *DummyHealth) Event(eventName string) {
	l.Logger.Debug(eventName)
}

func (l *DummyHealth) EventKv(eventName string, kvs map[string]string) {
	l.Logger.WithFields(dummyHealthKVToLogrusFields(kvs)).Debug(eventName)
}

func (l *DummyHealth) EventErr(eventName string, err error) error {
	err = fmt.Errorf("%s %s", eventName, err.Error())
	l.Logger.Error(err.Error())
	return err
}

func (l *DummyHealth) EventErrKv(eventName string, err error, kvs map[string]string) error {
	logrusKV := dummyHealthKVToLogrusFields(kvs)
	goarmorapiKV := goarmorapi.KV(logrusKV)

	err = fmt.Errorf("%s %s", eventName, err.Error())
	l.Logger.WithFields(logrusKV).Error(err.Error())

	return fmt.Errorf("%s %s", err.Error(), goarmorapiKV.String())
}

{'fraction_non_alphanumeric': 0.1511090573012939, 'fraction_numerical': 0.0009242144177449168, 'mean_word_length': 5.85126582278481, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2199345', 'n_tokens_mistral': 849, 'n_tokens_neox': 837, 'n_words': 158}