Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
67be6bbd
Commit
67be6bbd
authored
9 years ago
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skip logs when no writers connected
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
90896f28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
thirdparty/eventlog/log.go
thirdparty/eventlog/log.go
+5
-0
thirdparty/eventlog/writer.go
thirdparty/eventlog/writer.go
+7
-0
No files found.
thirdparty/eventlog/log.go
View file @
67be6bbd
...
...
@@ -83,6 +83,11 @@ func (el *eventLogger) EventBegin(ctx context.Context, event string, metadata ..
func
(
el
*
eventLogger
)
Event
(
ctx
context
.
Context
,
event
string
,
metadata
...
Loggable
)
{
// short circuit if theres nothing to write to
if
!
WriterGroup
.
Active
()
{
return
}
// Collect loggables for later logging
var
loggables
[]
Loggable
...
...
This diff is collapsed.
Click to expand it.
thirdparty/eventlog/writer.go
View file @
67be6bbd
...
...
@@ -29,3 +29,10 @@ func (mw *MirrorWriter) AddWriter(w io.Writer) {
mw
.
writers
=
append
(
mw
.
writers
,
w
)
mw
.
lk
.
Unlock
()
}
func
(
mw
*
MirrorWriter
)
Active
()
(
active
bool
)
{
mw
.
lk
.
Lock
()
active
=
len
(
mw
.
writers
)
>
0
mw
.
lk
.
Unlock
()
return
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment