Skip to content

Commit a21310a

Browse files
author
Matthew Fisher
committed
Merge pull request #2215 from bacongobbler/fixup-delta-datetime
fix(controller): add timezone back to API
2 parents 8db48dd + e61082d commit a21310a

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

client/deis.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,9 @@ def readable_datetime(datetime_str):
296296
Return a human-readable datetime string from an ECMA-262 (JavaScript)
297297
datetime string.
298298
"""
299-
dt = parser.parse(datetime_str)
300-
now = datetime.now()
299+
timezone = tz.tzlocal()
300+
dt = parser.parse(datetime_str).astimezone(timezone)
301+
now = datetime.now(timezone)
301302
delta = relativedelta.relativedelta(now, dt)
302303
# if it happened today, say "2 hours and 1 minute ago"
303304
if delta.days <= 1 and dt.day == now.day:
@@ -604,7 +605,7 @@ def apps_logs(self, args):
604605
# strip the last newline character
605606
for line in response.json().split('\n')[:-1]:
606607
# get the tag from the log
607-
log_tag = line.split(': ')[0].split(' ')[2]
608+
log_tag = line.split(': ')[0].split(' ')[1]
608609
# colorize the log based on the tag
609610
color = sum([ord(ch) for ch in log_tag]) % 6
610611
def f(x):

controller/deis/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
DEIS_DOMAIN = 'deisapp.local'
258258

259259
# standard datetime format used for logging, model timestamps, etc.
260-
DEIS_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
260+
DEIS_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S%Z'
261261

262262
# default scheduler settings
263263
SCHEDULER_MODULE = 'mock'

logspout/logspout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func syslogStreamer(target Target, types []string, logstream chan *Log) {
6868
// HACK: Go's syslog package hardcodes the log format, so let's send our own message
6969
_, err = fmt.Fprintf(conn,
7070
"%s %s[%s]: %s",
71-
time.Now().Format("2006-01-02 15:04:05"),
71+
time.Now().Format("2006-01-02T15:04:05MST"),
7272
tag,
7373
pid,
7474
logline.Data)

0 commit comments

Comments
 (0)