Show More
@@ -1,54 +1,54 b'' | |||||
1 | .c { color: #999988; font-style: italic } /* Comment */ |
|
1 | .c { color: #999988; font-style: italic } /* Comment */ | |
2 | .k { font-weight: bold } /* Keyword */ |
|
2 | .k { font-weight: bold } /* Keyword */ | |
3 | .o { font-weight: bold } /* Operator */ |
|
3 | .o { font-weight: bold } /* Operator */ | |
4 | .cm { color: #999988; font-style: italic } /* Comment.Multiline */ |
|
4 | .cm { color: #999988; font-style: italic } /* Comment.Multiline */ | |
5 | .cp { color: #999999; font-weight: bold } /* Comment.preproc */ |
|
5 | .cp { color: #999999; font-weight: bold } /* Comment.preproc */ | |
6 | .c1 { color: #999988; font-style: italic } /* Comment.Single */ |
|
6 | .c1 { color: #999988; font-style: italic } /* Comment.Single */ | |
7 | .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ |
|
7 | .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |
8 | .ge { font-style: italic } /* Generic.Emph */ |
|
8 | .ge { font-style: italic } /* Generic.Emph */ | |
9 | .gr { color: #aa0000 } /* Generic.Error */ |
|
9 | .gr { color: #aa0000 } /* Generic.Error */ | |
10 | .gh { color: #999999 } /* Generic.Heading */ |
|
10 | .gh { color: #999999 } /* Generic.Heading */ | |
11 | .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ |
|
11 | .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |
12 | .go { color: #111 } /* Generic.Output */ |
|
12 | .go { color: #111 } /* Generic.Output */ | |
13 | .gp { color: #555555 } /* Generic.Prompt */ |
|
13 | .gp { color: #555555 } /* Generic.Prompt */ | |
14 | .gs { font-weight: bold } /* Generic.Strong */ |
|
14 | .gs { font-weight: bold } /* Generic.Strong */ | |
15 | .gu { color: #aaaaaa } /* Generic.Subheading */ |
|
15 | .gu { color: #aaaaaa } /* Generic.Subheading */ | |
16 | .gt { color: #aa0000 } /* Generic.Traceback */ |
|
16 | .gt { color: #aa0000 } /* Generic.Traceback */ | |
17 | .kc { font-weight: bold } /* Keyword.Constant */ |
|
17 | .kc { font-weight: bold } /* Keyword.Constant */ | |
18 | .kd { font-weight: bold } /* Keyword.Declaration */ |
|
18 | .kd { font-weight: bold } /* Keyword.Declaration */ | |
19 | .kp { font-weight: bold } /* Keyword.Pseudo */ |
|
19 | .kp { font-weight: bold } /* Keyword.Pseudo */ | |
20 | .kr { font-weight: bold } /* Keyword.Reserved */ |
|
20 | .kr { font-weight: bold } /* Keyword.Reserved */ | |
21 | .kt { color: #445588; font-weight: bold } /* Keyword.Type */ |
|
21 | .kt { color: #445588; font-weight: bold } /* Keyword.Type */ | |
22 | .m { color: #009999 } /* Literal.Number */ |
|
22 | .m { color: #009999 } /* Literal.Number */ | |
23 | .s { color: #bb8844 } /* Literal.String */ |
|
23 | .s { color: #bb8844 } /* Literal.String */ | |
24 | .na { color: #008080 } /* Name.Attribute */ |
|
24 | .na { color: #008080 } /* Name.Attribute */ | |
25 | .nb { color: #999999 } /* Name.Builtin */ |
|
25 | .nb { color: #999999 } /* Name.Builtin */ | |
26 | .nc { color: #445588; font-weight: bold } /* Name.Class */ |
|
26 | .nc { color: #445588; font-weight: bold } /* Name.Class */ | |
27 | .no { color: #ff99ff } /* Name.Constant */ |
|
27 | .no { color: #ff99ff } /* Name.Constant */ | |
28 | .ni { color: #800080 } /* Name.Entity */ |
|
28 | .ni { color: #800080 } /* Name.Entity */ | |
29 | .ne { color: #990000; font-weight: bold } /* Name.Exception */ |
|
29 | .ne { color: #990000; font-weight: bold } /* Name.Exception */ | |
30 | .nf { color: #990000; font-weight: bold } /* Name.Function */ |
|
30 | .nf { color: #990000; font-weight: bold } /* Name.Function */ | |
31 | .nn { color: #555555 } /* Name.Namespace */ |
|
31 | .nn { color: #555555 } /* Name.Namespace */ | |
32 | .nt { color: #000080 } /* Name.Tag */ |
|
32 | .nt { color: #000080 } /* Name.Tag */ | |
33 | .nv { color: purple } /* Name.Variable */ |
|
33 | .nv { color: purple } /* Name.Variable */ | |
34 | .ow { font-weight: bold } /* Operator.Word */ |
|
34 | .ow { font-weight: bold } /* Operator.Word */ | |
35 | .mf { color: #009999 } /* Literal.Number.Float */ |
|
35 | .mf { color: #009999 } /* Literal.Number.Float */ | |
36 | .mh { color: #009999 } /* Literal.Number.Hex */ |
|
36 | .mh { color: #009999 } /* Literal.Number.Hex */ | |
37 | .mi { color: #009999 } /* Literal.Number.Integer */ |
|
37 | .mi { color: #009999 } /* Literal.Number.Integer */ | |
38 | .mo { color: #009999 } /* Literal.Number.Oct */ |
|
38 | .mo { color: #009999 } /* Literal.Number.Oct */ | |
39 | .sb { color: #bb8844 } /* Literal.String.Backtick */ |
|
39 | .sb { color: #bb8844 } /* Literal.String.Backtick */ | |
40 | .sc { color: #bb8844 } /* Literal.String.Char */ |
|
40 | .sc { color: #bb8844 } /* Literal.String.Char */ | |
41 | .sd { color: #bb8844 } /* Literal.String.Doc */ |
|
41 | .sd { color: #bb8844 } /* Literal.String.Doc */ | |
42 | .s2 { color: #bb8844 } /* Literal.String.Double */ |
|
42 | .s2 { color: #bb8844 } /* Literal.String.Double */ | |
43 | .se { color: #bb8844 } /* Literal.String.Escape */ |
|
43 | .se { color: #bb8844 } /* Literal.String.Escape */ | |
44 | .sh { color: #bb8844 } /* Literal.String.Heredoc */ |
|
44 | .sh { color: #bb8844 } /* Literal.String.Heredoc */ | |
45 | .si { color: #bb8844 } /* Literal.String.Interpol */ |
|
45 | .si { color: #bb8844 } /* Literal.String.Interpol */ | |
46 | .sx { color: #bb8844 } /* Literal.String.Other */ |
|
46 | .sx { color: #bb8844 } /* Literal.String.Other */ | |
47 | .sr { color: #808000 } /* Literal.String.Regex */ |
|
47 | .sr { color: #808000 } /* Literal.String.Regex */ | |
48 | .s1 { color: #bb8844 } /* Literal.String.Single */ |
|
48 | .s1 { color: #bb8844 } /* Literal.String.Single */ | |
49 | .ss { color: #bb8844 } /* Literal.String.Symbol */ |
|
49 | .ss { color: #bb8844 } /* Literal.String.Symbol */ | |
50 | .bp { color: #999999 } /* Name.Builtin.Pseudo */ |
|
50 | .bp { color: #999999 } /* Name.Builtin.Pseudo */ | |
51 | .vc { color: #ff99ff } /* Name.Variable.Class */ |
|
51 | .vc { color: #ff99ff } /* Name.Variable.Class */ | |
52 | .vg { color: #ff99ff } /* Name.Variable.Global */ |
|
52 | .vg { color: #ff99ff } /* Name.Variable.Global */ | |
53 | .vi { color: #ff99ff } /* Name.Variable.Instance */ |
|
53 | .vi { color: #ff99ff } /* Name.Variable.Instance */ | |
54 |
.il { color: #009999 } /* Literal.Number.Integer.Long */ |
|
54 | .il { color: #009999 } /* Literal.Number.Integer.Long */ No newline at end of file |
@@ -1,47 +1,46 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | rhodecode.lib.middleware.wrapper |
|
3 | rhodecode.lib.middleware.wrapper | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | request time mesuring app |
|
6 | request time mesuring app | |
7 |
|
7 | |||
8 | :created_on: May 23, 2013 |
|
8 | :created_on: May 23, 2013 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software: you can redistribute it and/or modify |
|
13 | # This program is free software: you can redistribute it and/or modify | |
14 | # it under the terms of the GNU General Public License as published by |
|
14 | # it under the terms of the GNU General Public License as published by | |
15 | # the Free Software Foundation, either version 3 of the License, or |
|
15 | # the Free Software Foundation, either version 3 of the License, or | |
16 | # (at your option) any later version. |
|
16 | # (at your option) any later version. | |
17 | # |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 | # |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 | import time |
|
25 | import time | |
26 | import logging |
|
26 | import logging | |
27 | from rhodecode.lib.base import _get_ip_addr, _get_access_path |
|
27 | from rhodecode.lib.base import _get_ip_addr, _get_access_path | |
28 | from rhodecode.lib.utils2 import safe_unicode |
|
28 | from rhodecode.lib.utils2 import safe_unicode | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | class RequestWrapper(object): |
|
31 | class RequestWrapper(object): | |
32 |
|
32 | |||
33 | def __init__(self, app, config): |
|
33 | def __init__(self, app, config): | |
34 | self.application = app |
|
34 | self.application = app | |
35 | self.config = config |
|
35 | self.config = config | |
36 |
|
36 | |||
37 | def __call__(self, environ, start_response): |
|
37 | def __call__(self, environ, start_response): | |
38 | start = time.time() |
|
38 | start = time.time() | |
39 | try: |
|
39 | try: | |
40 | return self.application(environ, start_response) |
|
40 | return self.application(environ, start_response) | |
41 | finally: |
|
41 | finally: | |
42 | log = logging.getLogger('rhodecode.' + self.__class__.__name__) |
|
42 | log = logging.getLogger('rhodecode.' + self.__class__.__name__) | |
43 | log.info('IP: %s Request to %s time: %.3fs' % ( |
|
43 | log.info('IP: %s Request to %s time: %.3fs' % ( | |
44 | _get_ip_addr(environ), |
|
44 | _get_ip_addr(environ), | |
45 | safe_unicode(_get_access_path(environ)), time.time() - start) |
|
45 | safe_unicode(_get_access_path(environ)), time.time() - start) | |
46 | ) |
|
46 | ) | |
47 |
|
General Comments 0
You need to be logged in to leave comments.
Login now