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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
0523b426
Commit
0523b426
authored
Sep 11, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Application logger
parent
49039103
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
20 deletions
+86
-20
app/assets/javascripts/admin.js.coffee
app/assets/javascripts/admin.js.coffee
+4
-0
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+1
-1
app/assets/stylesheets/sections/nav.scss
app/assets/stylesheets/sections/nav.scss
+0
-1
app/observers/project_observer.rb
app/observers/project_observer.rb
+12
-0
app/observers/user_observer.rb
app/observers/user_observer.rb
+12
-0
app/views/admin/logs/show.html.haml
app/views/admin/logs/show.html.haml
+26
-9
lib/gitlab/app_logger.rb
lib/gitlab/app_logger.rb
+11
-0
lib/gitlab/backend/gitolite_config.rb
lib/gitlab/backend/gitolite_config.rb
+7
-3
lib/gitlab/git_logger.rb
lib/gitlab/git_logger.rb
+11
-0
lib/gitlab/logger.rb
lib/gitlab/logger.rb
+2
-6
No files found.
app/assets/javascripts/admin.js.coffee
View file @
0523b426
...
@@ -6,3 +6,7 @@ $ ->
...
@@ -6,3 +6,7 @@ $ ->
elems
.
val
(
''
).
attr
'disabled'
,
true
elems
.
val
(
''
).
attr
'disabled'
,
true
else
else
elems
.
removeAttr
'disabled'
elems
.
removeAttr
'disabled'
$
(
'.log-tabs a'
).
click
(
e
)
->
e
.
preventDefault
()
$
(
this
).
tab
(
'show'
)
app/assets/javascripts/application.js
View file @
0523b426
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
//= require jquery.endless-scroll
//= require jquery.endless-scroll
//= require jquery.highlight
//= require jquery.highlight
//= require jquery.waitforimages
//= require jquery.waitforimages
//= require bootstrap
-modal
//= require bootstrap
//= require modernizr
//= require modernizr
//= require chosen-jquery
//= require chosen-jquery
//= require raphael
//= require raphael
...
...
app/assets/stylesheets/sections/nav.scss
View file @
0523b426
...
@@ -55,7 +55,6 @@ ul.main_menu {
...
@@ -55,7 +55,6 @@ ul.main_menu {
&
.current
{
&
.current
{
background-color
:
#D5D5D5
;
background-color
:
#D5D5D5
;
border-bottom
:
1px
solid
#AAA
;
border-right
:
1px
solid
#BBB
;
border-right
:
1px
solid
#BBB
;
border-left
:
1px
solid
#BBB
;
border-left
:
1px
solid
#BBB
;
border-radius
:
0
0
1px
1px
;
border-radius
:
0
0
1px
1px
;
...
...
app/observers/project_observer.rb
View file @
0523b426
...
@@ -4,6 +4,18 @@ class ProjectObserver < ActiveRecord::Observer
...
@@ -4,6 +4,18 @@ class ProjectObserver < ActiveRecord::Observer
end
end
def
after_destroy
(
project
)
def
after_destroy
(
project
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
project
.
destroy_repository
project
.
destroy_repository
end
end
def
after_create
project
log_info
(
"
#{
project
.
owner
.
name
}
created a new project
\"
#{
project
.
name
}
\"
"
)
end
protected
def
log_info
message
Gitlab
::
AppLogger
.
info
message
end
end
end
app/observers/user_observer.rb
View file @
0523b426
class
UserObserver
<
ActiveRecord
::
Observer
class
UserObserver
<
ActiveRecord
::
Observer
def
after_create
(
user
)
def
after_create
(
user
)
log_info
(
"User
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
) was created"
)
Notify
.
new_user_email
(
user
.
id
,
user
.
password
).
deliver
Notify
.
new_user_email
(
user
.
id
,
user
.
password
).
deliver
end
end
def
after_destroy
user
log_info
(
"User
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
) was removed"
)
end
protected
def
log_info
message
Gitlab
::
AppLogger
.
info
message
end
end
end
app/views/admin/logs/show.html.haml
View file @
0523b426
.file_holder
#README
%ul
.nav.nav-tabs.log-tabs
.file_title
%li
.active
%i
.icon-file
=
link_to
"githost.log"
,
"#githost"
,
'data-toggle'
=>
'tab'
githost.log
%li
.file_content.logs
=
link_to
"application.log"
,
"#application"
,
'data-toggle'
=>
'tab'
%ol
.tab-content
-
Gitlab
::
Logger
.
read_latest
.
each
do
|
line
|
.tab-pane.active
#githost
%li
.file_holder
#README
%p
=
line
.file_title
%i
.icon-file
githost.log
.file_content.logs
%ol
-
Gitlab
::
GitLogger
.
read_latest
.
each
do
|
line
|
%li
%p
=
line
.tab-pane
#application
.file_holder
#README
.file_title
%i
.icon-file
application.log
.file_content.logs
%ol
-
Gitlab
::
AppLogger
.
read_latest
.
each
do
|
line
|
%li
%p
=
line
lib/gitlab/app_logger.rb
0 → 100644
View file @
0523b426
module
Gitlab
class
AppLogger
<
Gitlab
::
Logger
def
self
.
file_name
'application.log'
end
def
format_message
(
severity
,
timestamp
,
progname
,
msg
)
"
#{
timestamp
.
to_s
(
:long
)
}
:
#{
msg
}
\n
"
end
end
end
lib/gitlab/backend/gitolite_config.rb
View file @
0523b426
...
@@ -58,18 +58,22 @@ module Gitlab
...
@@ -58,18 +58,22 @@ module Gitlab
end
end
end
end
rescue
PullError
=>
ex
rescue
PullError
=>
ex
Gitlab
::
Logger
.
error
(
"Pull error -> "
+
ex
.
message
)
log
(
"Pull error -> "
+
ex
.
message
)
raise
Gitolite
::
AccessDenied
,
ex
.
message
raise
Gitolite
::
AccessDenied
,
ex
.
message
rescue
PushError
=>
ex
rescue
PushError
=>
ex
Gitlab
::
Logger
.
error
(
"Push error -> "
+
" "
+
ex
.
message
)
log
(
"Push error -> "
+
" "
+
ex
.
message
)
raise
Gitolite
::
AccessDenied
,
ex
.
message
raise
Gitolite
::
AccessDenied
,
ex
.
message
rescue
Exception
=>
ex
rescue
Exception
=>
ex
Gitlab
::
Logger
.
error
(
ex
.
class
.
name
+
" "
+
ex
.
message
)
log
(
ex
.
class
.
name
+
" "
+
ex
.
message
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
end
end
def
log
message
Gitlab
::
GitLogger
.
error
(
message
)
end
def
destroy_project
(
project
)
def
destroy_project
(
project
)
FileUtils
.
rm_rf
(
project
.
path_to_repo
)
FileUtils
.
rm_rf
(
project
.
path_to_repo
)
conf
.
rm_repo
(
project
.
path
)
conf
.
rm_repo
(
project
.
path
)
...
...
lib/gitlab/git_logger.rb
0 → 100644
View file @
0523b426
module
Gitlab
class
GitLogger
<
Gitlab
::
Logger
def
self
.
file_name
'githost.log'
end
def
format_message
(
severity
,
timestamp
,
progname
,
msg
)
"
#{
timestamp
.
to_s
(
:long
)
}
->
#{
severity
}
->
#{
msg
}
\n
"
end
end
end
lib/gitlab/logger.rb
View file @
0523b426
...
@@ -9,17 +9,13 @@ module Gitlab
...
@@ -9,17 +9,13 @@ module Gitlab
end
end
def
self
.
read_latest
def
self
.
read_latest
path
=
Rails
.
root
.
join
(
"log
/githost.log"
)
path
=
Rails
.
root
.
join
(
"log
"
,
file_name
)
self
.
build
unless
File
.
exist?
(
path
)
self
.
build
unless
File
.
exist?
(
path
)
logs
=
File
.
read
(
path
).
split
(
"
\n
"
)
logs
=
File
.
read
(
path
).
split
(
"
\n
"
)
end
end
def
self
.
build
def
self
.
build
new
(
File
.
join
(
Rails
.
root
,
"log
/githost.log"
))
new
(
File
.
join
(
Rails
.
root
,
"log
"
,
file_name
))
end
end
def
format_message
(
severity
,
timestamp
,
progname
,
msg
)
"
#{
timestamp
.
to_s
(
:long
)
}
->
#{
severity
}
->
#{
msg
}
\n
"
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