From 396ef063552eed7eece3c812989f8729adcb4a5b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 9 Sep 2011 19:33:13 -0700 Subject: [PATCH] mason: more useful logging to console, with timestamps --- extra/mason/build/build.factor | 6 ++++-- extra/mason/common/common.factor | 5 ++++- extra/mason/email/email.factor | 2 +- extra/mason/git/git.factor | 1 + extra/mason/notify/notify.factor | 14 +++++++------- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/extra/mason/build/build.factor b/extra/mason/build/build.factor index 1b8089ed5e..03c5decc33 100644 --- a/extra/mason/build/build.factor +++ b/extra/mason/build/build.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov. +! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel calendar io.directories io.encodings.utf8 io.files io.launcher io.pathnames namespaces prettyprint -combinators mason.child mason.cleanup mason.common mason.config +combinators sequences mason.child mason.cleanup mason.common mason.config mason.docs mason.release mason.report mason.email mason.git mason.notify mason.platform mason.updates ; QUALIFIED: continuations @@ -13,9 +13,11 @@ IN: mason.build build-dir make-directory ; : enter-build-dir ( -- ) + "Building in directory " build-dir append print-timestamp build-dir set-current-directory ; : clone-source ( -- ) + "Cloning GIT repository" print-timestamp "git" "clone" builds-dir get "factor" append-path 3array short-running-process ; diff --git a/extra/mason/common/common.factor b/extra/mason/common/common.factor index 798f4d166a..8599c4e1d3 100644 --- a/extra/mason/common/common.factor +++ b/extra/mason/common/common.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008, 2010 Eduardo Cavazos, Slava Pestov. +! Copyright (C) 2008, 2011 Eduardo Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel namespaces sequences splitting system accessors math.functions make io io.files io.pathnames io.directories @@ -8,6 +8,9 @@ calendar.format arrays mason.config locals debugger fry continuations strings io.sockets ; IN: mason.common +: print-timestamp ( string -- ) + now timestamp>string write bl print flush ; + ERROR: no-host-name ; : short-host-name ( -- string ) diff --git a/extra/mason/email/email.factor b/extra/mason/email/email.factor index 68724b3ffa..d5ebb4bdc2 100644 --- a/extra/mason/email/email.factor +++ b/extra/mason/email/email.factor @@ -16,7 +16,7 @@ IN: mason.email _ >>subject send-email ] [ - "E-MAILING FAILED:" print + "E-MAILING FAILED:" print-timestamp error. flush ] recover ; diff --git a/extra/mason/git/git.factor b/extra/mason/git/git.factor index df344be12e..9740a6ebe5 100644 --- a/extra/mason/git/git.factor +++ b/extra/mason/git/git.factor @@ -21,6 +21,7 @@ IN: mason.git : git-clone ( -- ) #! Must be run from builds-dir + "Cloning initial repository" print-timestamp git-clone-cmd try-output-process ; : git-pull-cmd ( -- cmd ) diff --git a/extra/mason/notify/notify.factor b/extra/mason/notify/notify.factor index 89ddce590d..7946c3b0d3 100644 --- a/extra/mason/notify/notify.factor +++ b/extra/mason/notify/notify.factor @@ -28,7 +28,7 @@ IN: mason.notify http-post 2drop ] retry ] [ - "STATUS NOTIFY FAILED:" print + "STATUS NOTIFY FAILED:" print-timestamp error. flush ] recover ] [ 3drop ] if ; @@ -40,24 +40,24 @@ IN: mason.notify f f "idle" status-notify ; : notify-begin-build ( git-id -- ) - [ "Starting build of GIT ID " write print flush ] + [ "Starting build of GIT ID " prepend print-timestamp ] [ f swap "git-id" status-notify ] bi ; : notify-make-vm ( -- ) - "Compiling VM" print flush + "Compiling VM" print-timestamp f f "make-vm" status-notify ; : notify-boot ( -- ) - "Bootstrapping" print flush + "Bootstrapping" print-timestamp f f "boot" status-notify ; : notify-test ( -- ) - "Running tests" print flush + "Running tests" print-timestamp f f "test" status-notify ; : notify-report ( status -- ) - [ "Build finished with status: " write . flush ] + [ name>> "Build finished with status: " prepend print-timestamp ] [ [ "report" utf8 file-contents ] dip [ name>> "report" status-notify ] [ email-report ] 2bi @@ -70,6 +70,6 @@ IN: mason.notify f f "finish" status-notify ; : notify-release ( archive-name -- ) - [ "Uploaded " prepend [ print flush ] [ mason-tweet ] bi ] + [ "Uploaded " prepend [ print-timestamp ] [ mason-tweet ] bi ] [ f swap "release" status-notify ] bi ;