Merge pull request #7961 from cirosantilli/dry-log-file-names
Factor admin logs [failure unrelated]
This commit is contained in:
commit
ee068e76f3
6 changed files with 44 additions and 69 deletions
|
@ -1,68 +1,25 @@
|
||||||
|
- loggers = [Gitlab::GitLogger, Gitlab::AppLogger,
|
||||||
|
Gitlab::ProductionLogger, Gitlab::SidekiqLogger]
|
||||||
%ul.nav.nav-tabs.log-tabs
|
%ul.nav.nav-tabs.log-tabs
|
||||||
%li.active
|
- loggers.each do |klass|
|
||||||
= link_to "githost.log", "#githost", 'data-toggle' => 'tab'
|
%li{ class: (klass == Gitlab::GitLogger ? 'active' : '') }
|
||||||
%li
|
= link_to klass::file_name, "##{klass::file_name_noext}",
|
||||||
= link_to "application.log", "#application", 'data-toggle' => 'tab'
|
'data-toggle' => 'tab'
|
||||||
%li
|
|
||||||
= link_to "production.log", "#production", 'data-toggle' => 'tab'
|
|
||||||
%li
|
|
||||||
= link_to "sidekiq.log", "#sidekiq", 'data-toggle' => 'tab'
|
|
||||||
|
|
||||||
%p.light To prevent performance issues admin logs output the last 2000 lines
|
%p.light To prevent performance issues admin logs output the last 2000 lines
|
||||||
.tab-content
|
.tab-content
|
||||||
.tab-pane.active#githost
|
- loggers.each do |klass|
|
||||||
.file-holder#README
|
.tab-pane{ class: (klass == Gitlab::GitLogger ? 'active' : ''),
|
||||||
.file-title
|
id: klass::file_name_noext }
|
||||||
%i.fa.fa-file
|
.file-holder#README
|
||||||
githost.log
|
.file-title
|
||||||
.pull-right
|
%i.fa.fa-file
|
||||||
= link_to '#', class: 'log-bottom' do
|
= klass::file_name
|
||||||
%i.fa.fa-arrow-down
|
.pull-right
|
||||||
Scroll down
|
= link_to '#', class: 'log-bottom' do
|
||||||
.file-content.logs
|
%i.fa.fa-arrow-down
|
||||||
%ol
|
Scroll down
|
||||||
- Gitlab::GitLogger.read_latest.each do |line|
|
.file-content.logs
|
||||||
%li
|
%ol
|
||||||
%p= line
|
- klass.read_latest.each do |line|
|
||||||
.tab-pane#application
|
%li
|
||||||
.file-holder#README
|
%p= line
|
||||||
.file-title
|
|
||||||
%i.fa.fa-file
|
|
||||||
application.log
|
|
||||||
.pull-right
|
|
||||||
= link_to '#', class: 'log-bottom' do
|
|
||||||
%i.fa.fa-arrow-down
|
|
||||||
Scroll down
|
|
||||||
.file-content.logs
|
|
||||||
%ol
|
|
||||||
- Gitlab::AppLogger.read_latest.each do |line|
|
|
||||||
%li
|
|
||||||
%p= line
|
|
||||||
.tab-pane#production
|
|
||||||
.file-holder#README
|
|
||||||
.file-title
|
|
||||||
%i.fa.fa-file
|
|
||||||
production.log
|
|
||||||
.pull-right
|
|
||||||
= link_to '#', class: 'log-bottom' do
|
|
||||||
%i.fa.fa-arrow-down
|
|
||||||
Scroll down
|
|
||||||
.file-content.logs
|
|
||||||
%ol
|
|
||||||
- Gitlab::Logger.read_latest_for('production.log').each do |line|
|
|
||||||
%li
|
|
||||||
%p= line
|
|
||||||
.tab-pane#sidekiq
|
|
||||||
.file-holder#README
|
|
||||||
.file-title
|
|
||||||
%i.fa.fa-file
|
|
||||||
sidekiq.log
|
|
||||||
.pull-right
|
|
||||||
= link_to '#', class: 'log-bottom' do
|
|
||||||
%i.fa.fa-arrow-down
|
|
||||||
Scroll down
|
|
||||||
.file-content.logs
|
|
||||||
%ol
|
|
||||||
- Gitlab::Logger.read_latest_for('sidekiq.log').each do |line|
|
|
||||||
%li
|
|
||||||
%p= line
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Gitlab
|
module Gitlab
|
||||||
class AppLogger < Gitlab::Logger
|
class AppLogger < Gitlab::Logger
|
||||||
def self.file_name
|
def self.file_name_noext
|
||||||
'application.log'
|
'application'
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_message(severity, timestamp, progname, msg)
|
def format_message(severity, timestamp, progname, msg)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Gitlab
|
module Gitlab
|
||||||
class GitLogger < Gitlab::Logger
|
class GitLogger < Gitlab::Logger
|
||||||
def self.file_name
|
def self.file_name_noext
|
||||||
'githost.log'
|
'githost'
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_message(severity, timestamp, progname, msg)
|
def format_message(severity, timestamp, progname, msg)
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
module Gitlab
|
module Gitlab
|
||||||
class Logger < ::Logger
|
class Logger < ::Logger
|
||||||
|
def self.file_name
|
||||||
|
file_name_noext + '.log'
|
||||||
|
end
|
||||||
|
|
||||||
def self.error(message)
|
def self.error(message)
|
||||||
build.error(message)
|
build.error(message)
|
||||||
end
|
end
|
||||||
|
|
7
lib/gitlab/production_logger.rb
Normal file
7
lib/gitlab/production_logger.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Gitlab
|
||||||
|
class ProductionLogger < Gitlab::Logger
|
||||||
|
def self.file_name_noext
|
||||||
|
'production'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
7
lib/gitlab/sidekiq_logger.rb
Normal file
7
lib/gitlab/sidekiq_logger.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Gitlab
|
||||||
|
class SidekiqLogger < Gitlab::Logger
|
||||||
|
def self.file_name_noext
|
||||||
|
'sidekiq'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue