summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-11-08 17:58:34 +0000
committerLars Wirzenius <liw@liw.fi>2015-11-08 17:58:34 +0000
commitbc0f88bb9e0386bf187a566b63435eb87f720680 (patch)
tree493745a8e9f7e28c3821a3b7fd226a5578be52c5
parent5ca0ed2ff199515e51e7a858d661c0bc630d29ce (diff)
downloadick-bc0f88bb9e0386bf187a566b63435eb87f720680.tar.gz
Add start, end timestamps, build status to log
-rw-r--r--icklib/project.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/icklib/project.py b/icklib/project.py
index 6a22bdc..71c3718 100644
--- a/icklib/project.py
+++ b/icklib/project.py
@@ -21,6 +21,7 @@ import os
import re
import StringIO
import subprocess
+import time
import urllib
import urlparse
@@ -82,6 +83,9 @@ class Project(object):
self.progress['pipeline'] = pipeline_name
run_state.logger.important(
+ 'Build log starts {timestamp}',
+ timestamp=self.current_timestamp())
+ run_state.logger.important(
'Building project {project}',
project=self.name)
run_state.logger.important(
@@ -92,8 +96,29 @@ class Project(object):
if getattr(run_state, 'build_info', None) is not None:
run_state.build_info.status = 'FAILURE'
run_state.build_info.save()
+ run_state.logger.important('')
+ run_state.logger.important('Build status: FAILURE')
+ run_state.logger.important(
+ 'Build log ends {timestamp)',
+ self.current_timestamp())
raise
+ run_state.logger.important(
+ 'Build status: {status}',
+ status=run_state.build_info.status)
+ run_state.logger.important(
+ 'Build log ends {timestamp}',
+ timestamp=self.current_timestamp())
+
+ def current_timestamp(self):
+ timezone = '{sign}{h}{m}'.format(
+ sign='-' if time.timezone < 0 else '+',
+ h=abs(time.timezone) / 3600,
+ m=(abs(time.timezone) % 3600) / 60)
+ return '{timestamp} {timezone}'.format(
+ timestamp=time.strftime('%Y-%m-%d %H:%M:%S'),
+ timezone=timezone)
+
def run_locally(self, argv, displayed_cmd, cwd):
self.report_running_locally(displayed_cmd)
self.run_state.logger.important(