<commit_before>package log

/* CHECKLIST
 * [x] Uses interfaces as appropriate
 * [x] Private package variables use underscore prefix
 * [x] All parameters validated
 * [x] All errors handled
 * [x] Reviewed for concurrency safety
 * [x] Code complete
 * [x] Full test coverage
 */

import (
	"github.com/Sirupsen/logrus"

	"github.com/tidepool-org/platform/app"
)

type Config struct {
	Level string `default:"warn"`
}

func (c *Config) Validate() error {
	if level, err := logrus.ParseLevel(c.Level); err != nil {
		return app.ExtError(err, "log", "level is invalid")
	} else if level == logrus.PanicLevel {
		return app.Error("log", "level is invalid")
	}
	return nil
}<commit_msg>Specify JSON tag for log config level field<commit_after>package log

/* CHECKLIST
 * [x] Uses interfaces as appropriate
 * [x] Private package variables use underscore prefix
 * [x] All parameters validated
 * [x] All errors handled
 * [x] Reviewed for concurrency safety
 * [x] Code complete
 * [x] Full test coverage
 */

import (
	"github.com/Sirupsen/logrus"

	"github.com/tidepool-org/platform/app"
)

type Config struct {
	Level string `json:"level" default:"warn"`
}

func (c *Config) Validate() error {
	if level, err := logrus.ParseLevel(c.Level); err != nil {
		return app.ExtError(err, "log", "level is invalid")
	} else if level == logrus.PanicLevel {
		return app.Error("log", "level is invalid")
	}
	return nil
}
{'fraction_non_alphanumeric': 0.12969525159461376, 'fraction_numerical': 0.0, 'mean_word_length': 4.172161172161172, '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': '599482', 'n_tokens_mistral': 469, 'n_tokens_neox': 459, 'n_words': 152}