<commit_before>package event_override_ts

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"os"
	"time"

	"github.com/karimra/gnmic/formatters"
)

const (
	processorType = "event-override-ts"
)

// OverrideTS Drops the msg if ANY of the Tags or Values regexes are matched
type OverrideTS struct {
	Precision string `mapstructure:"precision,omitempty" json:"precision,omitempty"`
	Debug     bool   `mapstructure:"debug,omitempty" json:"debug,omitempty"`

	logger *log.Logger
}

func init() {
	formatters.Register(processorType, func() formatters.EventProcessor {
		return &OverrideTS{}
	})
}

func (o *OverrideTS) Init(cfg interface{}, logger *log.Logger) error {
	err := formatters.DecodeConfig(cfg, 0)
	if err != nil {
		return err
	}
	if o.Debug && logger != nil {
		o.logger = log.New(logger.Writer(), processorType+" ", logger.Flags())
	} else if o.Debug {
		o.logger = log.New(os.Stderr, processorType+" ", log.LstdFlags|log.Lmicroseconds)
	} else {
		o.logger = log.New(ioutil.Discard, "", 0)
	}
	if o.Precision == "" {
		o.Precision = "ns"<commit_msg>fix comment<commit_after>package event_override_ts

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"os"
	"time"

	"github.com/karimra/gnmic/formatters"
)

const (
	processorType = "event-override-ts"
)

// OverrideTS Overrides the message timestamp with the local time
type OverrideTS struct {
	Precision string `mapstructure:"precision,omitempty" json:"precision,omitempty"`
	Debug     bool   `mapstructure:"debug,omitempty" json:"debug,omitempty"`

	logger *log.Logger
}

func init() {
	formatters.Register(processorType, func() formatters.EventProcessor {
		return &OverrideTS{}
	})
}

func (o *OverrideTS) Init(cfg interface{}, logger *log.Logger) error {
	err := formatters.DecodeConfig(cfg, 0)
	if err != nil {
		return err
	}
	if o.Debug && logger != nil {
		o.logger = log.New(logger.Writer(), processorType+" ", logger.Flags())
	} else if o.Debug {
		o.logger = log.New(os.Stderr, processorType+" ", log.LstdFlags|log.Lmicroseconds)
	} else {
		o.logger = log.New(ioutil.Discard, "", 0)
	}
	if o.Precision == "" {
		o.Precision = "ns"
{'fraction_non_alphanumeric': 0.14768937589328252, 'fraction_numerical': 0.0019056693663649356, 'mean_word_length': 4.426356589147287, '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': '4036379', 'n_tokens_mistral': 769, 'n_tokens_neox': 735, 'n_words': 165}