Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e1b4e6a9
Commit
e1b4e6a9
authored
Apr 27, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY up things further in LogCursor::Logger
parent
406c702a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
ee/lib/gitlab/geo/log_cursor/daemon.rb
ee/lib/gitlab/geo/log_cursor/daemon.rb
+5
-3
ee/lib/gitlab/geo/log_cursor/logger.rb
ee/lib/gitlab/geo/log_cursor/logger.rb
+9
-11
No files found.
ee/lib/gitlab/geo/log_cursor/daemon.rb
View file @
e1b4e6a9
...
...
@@ -303,11 +303,13 @@ module Gitlab
def
logger
strong_memoize
(
:logger
)
do
level
=
options
[
:debug
]
?
:debug
:
Rails
.
logger
.
level
Gitlab
::
Geo
::
LogCursor
::
Logger
.
new
(
self
.
class
,
level
)
Gitlab
::
Geo
::
LogCursor
::
Logger
.
new
(
self
.
class
,
log_level
)
end
end
def
log_level
options
[
:debug
]
?
:debug
:
Rails
.
logger
.
level
end
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/logger.rb
View file @
e1b4e6a9
...
...
@@ -6,29 +6,27 @@ module Gitlab
PID
=
Process
.
pid
.
freeze
def
initialize
(
klass
,
level
=
Rails
.
logger
.
leve
l
)
def
initialize
(
klass
,
level
=
ni
l
)
@klass
=
klass
geo_logger
.
build
.
level
=
level
geo_logger
.
build
.
level
=
level
unless
level
.
nil?
end
def
event_info
(
created_at
,
message
,
params
=
{})
args
=
base_log_data
(
message
).
merge
(
cursor_delay_s:
cursor_delay
(
created_at
)
).
merge
(
params
)
params
=
params
.
merge
(
cursor_delay_s:
cursor_delay
(
created_at
))
geo_logger
.
info
(
arg
s
)
info
(
message
,
param
s
)
end
def
info
(
message
,
params
=
{})
geo_logger
.
info
(
base_log_data
(
message
).
merge
(
params
))
geo_logger
.
info
(
base_log_data
(
message
,
params
))
end
def
error
(
message
,
params
=
{})
geo_logger
.
error
(
base_log_data
(
message
).
merge
(
params
))
geo_logger
.
error
(
base_log_data
(
message
,
params
))
end
def
debug
(
message
,
params
=
{})
geo_logger
.
debug
(
base_log_data
(
message
).
merge
(
params
))
geo_logger
.
debug
(
base_log_data
(
message
,
params
))
end
private
...
...
@@ -45,12 +43,12 @@ module Gitlab
(
Time
.
now
-
created_at
).
to_f
.
round
(
3
)
end
def
base_log_data
(
message
)
def
base_log_data
(
message
,
params
=
{}
)
{
pid:
PID
,
class:
caller_name
,
message:
message
}
}
.
merge
(
params
)
end
end
end
...
...
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