Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
gitlab-runner
Commits
f92380ce
Verified
Commit
f92380ce
authored
6 years ago
by
Tomasz Maczukin
Browse files
Options
Downloads
Patches
Plain Diff
Specify logger explicitly when using AddSecretsClenupLogHook
parent
304f2d17
No related branches found
No related tags found
1 merge request
!1020
Support json logging
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/gitlab-runner-helper/main.go
+1
-1
1 addition, 1 deletion
apps/gitlab-runner-helper/main.go
log/secrets_cleanup.go
+6
-2
6 additions, 2 deletions
log/secrets_cleanup.go
log/secrets_cleanup_test.go
+1
-1
1 addition, 1 deletion
log/secrets_cleanup_test.go
with
8 additions
and
4 deletions
apps/gitlab-runner-helper/main.go
+
1
−
1
View file @
f92380ce
...
...
@@ -40,7 +40,7 @@ func main() {
logrus
.
Fatalln
(
"Command"
,
command
,
"not found"
)
}
log
.
AddSecretsCleanupLogHook
()
log
.
AddSecretsCleanupLogHook
(
logrus
.
StandardLogger
()
)
log
.
ConfigureLogging
(
app
)
if
err
:=
app
.
Run
(
os
.
Args
);
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
log/secrets_cleanup.go
+
6
−
2
View file @
f92380ce
...
...
@@ -17,6 +17,10 @@ func (s *SecretsCleanupHook) Fire(entry *logrus.Entry) error {
return
nil
}
func
AddSecretsCleanupLogHook
()
{
logrus
.
AddHook
(
new
(
SecretsCleanupHook
))
func
AddSecretsCleanupLogHook
(
logger
*
logrus
.
Logger
)
{
if
logger
==
nil
{
logger
=
logrus
.
StandardLogger
()
}
logger
.
AddHook
(
new
(
SecretsCleanupHook
))
}
This diff is collapsed.
Click to expand it.
log/secrets_cleanup_test.go
+
1
−
1
View file @
f92380ce
...
...
@@ -32,7 +32,7 @@ func TestSecretsCleanupHook(t *testing.T) {
logger
:=
logrus
.
New
()
logger
.
Out
=
buffer
logger
.
AddHook
(
new
(
SecretsCleanupHook
)
)
Add
SecretsCleanup
Log
Hook
(
logger
)
logger
.
Errorln
(
test
.
message
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment