Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add log nsq backend and nsq publish supported #12

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add log nsq
  • Loading branch information
[email protected] committed Apr 18, 2018
commit 972142af76f42a7689c0e48dddab5d65ffedf415
8 changes: 8 additions & 0 deletions config/samples/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ log:
- name: 'auxo.net.web'
level: debug
writers: text
- name: 'auxo.mq.nsq'
level: debug
writers: nsq
- name: 'benchmark1'
level: debug
writers: drop1
Expand All @@ -41,6 +44,11 @@ log:
format: json
options:
colorized: true
- name: nsq
type: nsq
layout: '{level: a=b},{time: 2006-01-02T15:04:05.000Z07:00},{msg},{file:short},{newline}'
options:
topic: "mq_nsq_writer"

web:
mode: develop
Expand Down
9 changes: 9 additions & 0 deletions log/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ func TestLogger(t *testing.T) {
l.Error("error")
}

func TestNsqLogger(t *testing.T) {
l := log.Get("auxo.mq.nsq")
assert.NotNil(t, l)

l.Debug("debug")
l.Info("info")
l.Warn("warn")
l.Error("error")
}
func TestFileLogger(t *testing.T) {
l := log.Get("test")
for i := 0; i < 100; i++ {
Expand Down