Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3mon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
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
km3py
km3mon
Commits
c5a7036b
Commit
c5a7036b
authored
5 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Show filesize in logs
parent
904698f8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/routes.py
+7
-4
7 additions, 4 deletions
app/routes.py
app/templates/logs.html
+2
-2
2 additions, 2 deletions
app/templates/logs.html
with
9 additions
and
6 deletions
app/routes.py
+
7
−
4
View file @
c5a7036b
from
glob
import
glob
from
os.path
import
basename
,
join
,
exists
,
splitext
from
os.path
import
basename
,
join
,
exists
,
splitext
,
getsize
from
functools
import
wraps
from
collections
import
OrderedDict
import
toml
from
flask
import
render_template
,
send_from_directory
,
request
,
Response
from
app
import
app
...
...
@@ -160,9 +161,11 @@ def trigger():
@app.route
(
'
/logs.html
'
)
@requires_auth
def
logs
():
msg_logs
=
map
(
basename
,
sorted
(
glob
(
join
(
app
.
root_path
,
LOGS_PATH
,
"
MSG*.log
"
))))
return
render_template
(
'
logs.html
'
,
filenames
=
msg_logs
)
files
=
OrderedDict
()
for
filename
in
sorted
(
glob
(
join
(
app
.
root_path
,
LOGS_PATH
,
"
MSG*.log
"
))):
files
[
basename
(
filename
)]
=
getsize
(
filename
)
print
(
files
)
return
render_template
(
'
logs.html
'
,
files
=
files
)
@app.route
(
'
/logs/<path:filename>
'
)
...
...
This diff is collapsed.
Click to expand it.
app/templates/logs.html
+
2
−
2
View file @
c5a7036b
...
...
@@ -6,8 +6,8 @@
<div
class=
"container-fluid"
id=
"logs"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
{% for filename
in filenames
%}
<a
href=
"/logs/{{ filename }}"
class=
"btn btn-warning"
role=
"button"
>
{{ filename }}
</a></button>
{% for filename
, filesize in files.items()
%}
<a
href=
"/logs/{{ filename }}"
class=
"btn btn-warning"
role=
"button"
>
{{ filename }}
({{'%0.1f' | format(filesize/1024) }}MB)
</a></button>
{% endfor %}
</div>
</div>
...
...
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