summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2013-10-02 18:47:07 +0100
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2013-10-02 18:47:07 +0100
commitee630003284c4f7373b0f90ca5195d6892281772 (patch)
tree5a7e6617a98c447074b14b1c8310e68cffecbc1a
parent400b5951ffebc669cccc6081442a2742587a0bfe (diff)
downloadgitano-ee630003284c4f7373b0f90ca5195d6892281772.tar.gz
Add syslogging to gitano-post-receive-hookbaserock/richardipsum/syslog
-rw-r--r--bin/gitano-post-receive-hook.in37
1 files changed, 29 insertions, 8 deletions
diff --git a/bin/gitano-post-receive-hook.in b/bin/gitano-post-receive-hook.in
index b272b17..f495d89 100644
--- a/bin/gitano-post-receive-hook.in
+++ b/bin/gitano-post-receive-hook.in
@@ -23,6 +23,7 @@ local start_log_level = gitano.log.get_level()
-- Clamp level at info until we have checked if the caller
-- is an admin or not
gitano.log.cap_level(gitano.log.level.INFO)
+gitano.log.syslog.open()
local repo_root = luxio.getenv("GITANO_ROOT")
local username = luxio.getenv("GITANO_USER") or "gitano/anonymous"
@@ -90,27 +91,41 @@ end
-- that the updates (if any) will have been applied
if updates["refs/gitano/admin"] then
- gitano.log.chat("<" .. repo.name .. ">",
- "Any changes to admin ref have been applied.")
+ local msg = "<" .. repo.name .. ">" .. " Any changes to admin ref have been applied."
+
+ gitano.log.chat(msg)
+ gitano.log.syslog.info(msg)
end
local function report_repo(reponame, repo, msg)
if repo then
- gitano.log.chat("<" .. reponame .. ">",
- "Any changes to hooks etc have been applied")
+ local s = "<" .. reponame ..">" .. " Any changes to hooks etc have been applied"
+
+ gitano.log.chat(s)
+ gitano.log.syslog.info(s)
else
- gitano.log.crit("<" .. reponame ..">", "Unable to process:", msg)
+ gitano.log.crit("<" .. reponame .. ">", "Unable to process:", msg)
end
end
if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then
-- Updating the 'master' of gitano-admin, let's iterate all the repositories
- gitano.log.chat("Scanning repositories to apply hook/rules updates...")
+
+ gitano.log.syslog.info("Updating gitano-admin")
+
+ local msg = "Scanning repositories to apply hook/rules updates..."
+ gitano.log.chat(msg)
+ gitano.log.syslog.info(msg)
+
local ok, msg = gitano.repository.foreach(config, report_repo)
if not ok then
gitano.log.crit(msg)
end
- gitano.log.chat("All repositories updated where possible.")
+
+ msg = "All repositories updated where possible."
+ gitano.log.chat(msg)
+ gitano.log.syslog.info(msg)
+
local proc = sp.spawn({
gitano.config.lib_bin_path() .. "/gitano-update-ssh",
gitano.config.repo_path()
@@ -140,7 +155,11 @@ end
if repo:uses_hook("post-receive") then
gitano.log.debug("Configuring for post-receive hook")
gitano.actions.set_supple_globals("post-receive")
- gitano.log.info("Running repository post-receive hook")
+
+ local msg = "Running repository post-receive hook"
+ gitano.log.info(msg)
+ gitano.log.syslog.info(msg)
+
local info = {
username = username,
keytag = keytag,
@@ -155,4 +174,6 @@ if repo:uses_hook("post-receive") then
gitano.log.info("Finished")
end
+gitano.log.syslog.close()
+
return 0