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
...
@@ -303,11 +303,13 @@ module Gitlab
def
logger
def
logger
strong_memoize
(
:logger
)
do
strong_memoize
(
:logger
)
do
level
=
options
[
:debug
]
?
:debug
:
Rails
.
logger
.
level
Gitlab
::
Geo
::
LogCursor
::
Logger
.
new
(
self
.
class
,
log_level
)
Gitlab
::
Geo
::
LogCursor
::
Logger
.
new
(
self
.
class
,
level
)
end
end
end
end
def
log_level
options
[
:debug
]
?
:debug
:
Rails
.
logger
.
level
end
end
end
end
end
end
end
...
...
ee/lib/gitlab/geo/log_cursor/logger.rb
View file @
e1b4e6a9
...
@@ -6,29 +6,27 @@ module Gitlab
...
@@ -6,29 +6,27 @@ module Gitlab
PID
=
Process
.
pid
.
freeze
PID
=
Process
.
pid
.
freeze
def
initialize
(
klass
,
level
=
Rails
.
logger
.
leve
l
)
def
initialize
(
klass
,
level
=
ni
l
)
@klass
=
klass
@klass
=
klass
geo_logger
.
build
.
level
=
level
geo_logger
.
build
.
level
=
level
unless
level
.
nil?
end
end
def
event_info
(
created_at
,
message
,
params
=
{})
def
event_info
(
created_at
,
message
,
params
=
{})
args
=
base_log_data
(
message
).
merge
(
params
=
params
.
merge
(
cursor_delay_s:
cursor_delay
(
created_at
))
cursor_delay_s:
cursor_delay
(
created_at
)
).
merge
(
params
)
geo_logger
.
info
(
arg
s
)
info
(
message
,
param
s
)
end
end
def
info
(
message
,
params
=
{})
def
info
(
message
,
params
=
{})
geo_logger
.
info
(
base_log_data
(
message
).
merge
(
params
))
geo_logger
.
info
(
base_log_data
(
message
,
params
))
end
end
def
error
(
message
,
params
=
{})
def
error
(
message
,
params
=
{})
geo_logger
.
error
(
base_log_data
(
message
).
merge
(
params
))
geo_logger
.
error
(
base_log_data
(
message
,
params
))
end
end
def
debug
(
message
,
params
=
{})
def
debug
(
message
,
params
=
{})
geo_logger
.
debug
(
base_log_data
(
message
).
merge
(
params
))
geo_logger
.
debug
(
base_log_data
(
message
,
params
))
end
end
private
private
...
@@ -45,12 +43,12 @@ module Gitlab
...
@@ -45,12 +43,12 @@ module Gitlab
(
Time
.
now
-
created_at
).
to_f
.
round
(
3
)
(
Time
.
now
-
created_at
).
to_f
.
round
(
3
)
end
end
def
base_log_data
(
message
)
def
base_log_data
(
message
,
params
=
{}
)
{
{
pid:
PID
,
pid:
PID
,
class:
caller_name
,
class:
caller_name
,
message:
message
message:
message
}
}
.
merge
(
params
)
end
end
end
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