Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
roqua-support
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RoQua
roqua-support
Commits
ce167089
Commit
ce167089
authored
3 years ago
by
Jorn van de Beek
Browse files
Options
Downloads
Patches
Plain Diff
Add timezone to log lines
parent
8c67cd7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!45
Timezone toevoegen aan Roqua logging railtie regels
Pipeline
#96149
passed
3 years ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/roqua/logging/roqua_logging_railtie.rb
+2
-0
2 additions, 0 deletions
lib/roqua/logging/roqua_logging_railtie.rb
spec/roqua/logging/roqua_logging_railtie_spec.rb
+6
-0
6 additions, 0 deletions
spec/roqua/logging/roqua_logging_railtie_spec.rb
with
8 additions
and
0 deletions
lib/roqua/logging/roqua_logging_railtie.rb
+
2
−
0
View file @
ce167089
...
...
@@ -7,6 +7,8 @@ class RoquaLoggingRailtie < Rails::Railtie
def
configure
Roqua
.
logger
=
ActiveSupport
::
Logger
.
new
(
output_stream
).
tap
do
|
logger
|
logger
.
formatter
=
Logger
::
Formatter
.
new
# Set the datetime_format to include timezone and use milliseconds instead of microseconds
logger
.
formatter
.
datetime_format
=
'%Y-%m-%dT%H:%M:%S.%L%z '
end
require
'roqua/support/request_logger'
...
...
This diff is collapsed.
Click to expand it.
spec/roqua/logging/roqua_logging_railtie_spec.rb
+
6
−
0
View file @
ce167089
...
...
@@ -27,6 +27,12 @@ Rspec.describe RoquaLoggingRailtie do
ActiveSupport
::
Logger
.
logger_outputs_to?
(
Roqua
.
logger
.
logger
,
STDOUT
)
).
to
be_truthy
end
it
'logs using a datetimeformat including timezone'
do
time
=
Time
.
zone
.
local
(
2021
,
10
,
10
,
16
,
13
)
got
=
Roqua
.
logger
.
logger
.
formatter
.
call
'INFO'
,
time
,
'progname'
,
'{}'
expect
(
got
).
to
match
(
/I, \[2021-10-10T16:13:00.000\+0000 #\d+] INFO -- progname: {}/
)
end
end
context
'when RAILS_LOG_TO_STDOUT_USING_ROQUA_LOGGER is blank'
do
...
...
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