<commit_before>package logger

import "testing"

func TestMulti(t *testing.T) {
	m1 := newMock()
	m2 := newMock()
	l := NewMultiLogger(m1, m2)

	m1.checkLnCount(t, 0, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 0, 0, 0, 0, 0)
	m2.checkLnCount(t, 0, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 0, 0, 0, 0, 0)

	l.SetLevel(Everything)
	l.Debugln()

	m1.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 0, 0, 0, 0, 0)
	m2.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 0, 0, 0, 0, 0)

	l.Verbosef("")

	m1.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 1, 0, 0, 0, 0)
	m2.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 1, 0, 0, 0, 0)

	l.SetLevel(LevelWarn)

	// should not log
	l.Infoln()

	m1.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 1, 0, 0, 0, 0)
	m2.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 1, 0, 0, 0, 0)<commit_msg>added test for MultiLogger.SetLevel and MultiLogger.PropagateLevel<commit_after>package logger

import "testing"

func TestMulti(t *testing.T) {
	m1 := newMock()
	m2 := newMock()
	l := NewMultiLogger(m1, m2)

	l.SetLevel(Off)
	if l.Logs(LevelDebug) {
		t.Error("MultiLogger still logs after turing it Off")
	}

	l.PropagateLevel()
	if m1.Level() != Off || m2.Level() != Off {
		t.Errorf("PropagateLevel did not propagate properly, expected: %d,%d - got %d,%d", Off, Off, m1.Level(), m2.Level())
	}

	l.SetLevel(Everything)
	if !l.Logs(Everything) {
		t.Error("MultiLogger does not log Everything after it was instructed to")
	}

	l.PropagateLevel()
	if m1.Level() != Everything || m2.Level() != Everything {
		t.Errorf("PropagateLevel did not propagate properly, expected: %d,%d - got %d,%d", Everything, Everything, m1.Level(), m2.Level())
	}

	m1.checkLnCount(t, 0, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 0, 0, 0, 0, 0)
	m2.checkLnCount(t, 0, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 0, 0, 0, 0, 0)

	l.Debugln()

	m1.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 0, 0, 0, 0, 0)
	m2.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 0, 0, 0, 0, 0)

	l.Verbosef("")

	m1.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 1, 0, 0, 0, 0)
	m2.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 1, 0, 0, 0, 0)

	l.SetLevel(LevelWarn)

	// should not log
	l.Infoln()

	m1.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m1.checkFCount(t, 0, 1, 0, 0, 0, 0)
	m2.checkLnCount(t, 1, 0, 0, 0, 0, 0)
	m2.checkFCount(t, 0, 1, 0, 0, 0, 0)
{'fraction_non_alphanumeric': 0.19975031210986266, 'fraction_numerical': 0.09987515605493133, 'mean_word_length': 3.623076923076923, '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': '599553', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1205, 'n_words': 332}