Skip to content

Commit

Permalink
Renamed MockScribe.Loggers() -> .Factories()
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoutanov committed Apr 19, 2020
1 parent a9cf8a9 commit fa6dacf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion diags/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestWatch_triggered(t *testing.T) {

func TestPrint(t *testing.T) {
m := scribe.NewMock()
scr := scribe.New(m.Loggers())
scr := scribe.New(m.Factories())

w := Watch("op", time.Millisecond, Print(scr.W()))
defer w.End()
Expand Down
8 changes: 4 additions & 4 deletions scribe/mockscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// MockScribe provides a facility for mocking a Scribe, capturing log calls for subsequent inspection, filtering and assertions.
// This implementation is thread-safe.
type MockScribe interface {
Loggers() LoggerFactories
Factories() LoggerFactories
Reset()
Entries() Entries
ContainsEntries() DynamicAssertion
Expand Down Expand Up @@ -66,7 +66,7 @@ type mockScribe struct {
// NewMock creates a new MockScribe. The returning instance cannot be used to log directly — only to inspect and assert captures.
// To configure a Scribe to use the mocks for subsequent logging:
// mock := scribe.NewMock()
// scribe := scribe.New(mock.Loggers())
// scribe := scribe.New(mock.Factories())
func NewMock() MockScribe {
return &mockScribe{}
}
Expand All @@ -75,8 +75,8 @@ func NewMock() MockScribe {
Implemented methods.
*/

// Loggers obtains the necessary LoggerFactories to configure Scribe.
func (s *mockScribe) Loggers() LoggerFactories {
// Factories obtains the necessary LoggerFactories to configure Scribe.
func (s *mockScribe) Factories() LoggerFactories {
facs := LoggerFactories{}

for _, l := range Levels {
Expand Down
12 changes: 6 additions & 6 deletions scribe/mockscribe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func TestBasicLogging(t *testing.T) {
m := NewMock()
l := New(m.Loggers())
l := New(m.Factories())
l.SetEnabled(All)

l.T()("Trace %d %d", 0, 1)
Expand Down Expand Up @@ -55,7 +55,7 @@ func TestBasicLogging(t *testing.T) {

func TestSceneLogging(t *testing.T) {
m := NewMock()
l := New(m.Loggers())
l := New(m.Factories())
l.SetEnabled(All)

testScene := func(name, value string) Scene {
Expand Down Expand Up @@ -136,7 +136,7 @@ func TestCustomLevel(t *testing.T) {

func TestDynamicAssertions(t *testing.T) {
m := NewMock()
l := New(m.Loggers())
l := New(m.Factories())

l.I()("Info %d %d", 4, 5)
l.W()("Warn %d %d", 5, 6)
Expand Down Expand Up @@ -166,7 +166,7 @@ func TestDynamicAssertions(t *testing.T) {

func TestMultithreadedLogging(t *testing.T) {
m := NewMock()
l := New(m.Loggers())
l := New(m.Factories())
l.SetEnabled(All)

const routines = 100
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestMultithreadedLogging(t *testing.T) {

func TestRest(t *testing.T) {
m := NewMock()
l := New(m.Loggers())
l := New(m.Factories())
l.SetEnabled(All)

l.T()("Trace %d %d", 0, 1)
Expand All @@ -212,7 +212,7 @@ func TestRest(t *testing.T) {

func TestAssertionFailures(t *testing.T) {
m := NewMock()
l := New(m.Loggers())
l := New(m.Factories())
l.SetEnabled(All)

l.T()("Trace %d %d", 0, 1)
Expand Down

0 comments on commit fa6dacf

Please sign in to comment.