More logs please

This commit is contained in:
kagel 2016-09-15 00:35:50 +03:00
parent 59a60aa261
commit 88ed27d100
4 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,6 @@
(ns commiteth.eth.multisig-wallet
(:require [commiteth.eth.core :as eth]))
(:require [commiteth.eth.core :as eth]
[clojure.tools.logging :as log]))
(defn is-owner?
[contract address]
@ -11,12 +12,15 @@
(defn add-owner
[contract owner]
(log/debug "multiowned.addOwner(contract, owner)" contract owner)
(eth/execute (eth/eth-account) contract "0x7065cb48" owner))
(defn execute
[contract to value]
(log/debug "multisig.execute(contract, to, value)" contract to value)
(eth/execute (eth/eth-account) contract "0xb61d27f6" to value))
(defn confirm
[contract hash]
(log/debug "multisig.confirm(contract, hash)")
(eth/execute (eth/eth-account) contract "0x797af627" hash))

View File

@ -77,8 +77,8 @@
(users/me (auth-params token)))
(defn add-webhook
[token user repo]
(log/debug "adding webhook")
[user repo token]
(log/debug "adding webhook" (str user "/" repo) token)
(repos/create-hook user repo "web"
{:url (str (server-address) "/webhook")
:content_type "json"}
@ -87,8 +87,8 @@
:active true})))
(defn remove-webhook
[token user repo hook-id]
(log/debug "removing webhook")
[user repo hook-id token]
(log/debug "removing webhook" (str user "/" repo) hook-id token)
(repos/delete-hook user repo hook-id (auth-params token)))
(defn github-comment-hash
@ -120,13 +120,13 @@
(defn post-comment
[user repo issue-number balance]
(let [comment (generate-comment user repo issue-number balance)]
(log/info "Comment to" (str user "/" repo) ":" comment)
(log/debug "Posting comment to" (str user "/" repo) ":" comment)
(issues/create-comment user repo issue-number comment (self-auth-params))))
(defn update-comment
[user repo comment-id issue-number balance]
(let [comment (generate-comment user repo issue-number balance)]
(log/info (str "Updating " user "/" repo " comment #" comment-id " with contents: " comment))
(log/debug (str "Updating " user "/" repo " comment #" comment-id " with contents: " comment))
(issues/edit-comment user repo comment-id comment (self-auth-params))))
(defn get-issue
@ -139,4 +139,5 @@
(defn create-label
[user repo token]
(log/debug "creating bounty label" (str user "/" repo) token)
(issues/create-label user repo "bounty" "00ff00" (auth-params token)))

View File

@ -75,9 +75,9 @@
(repositories/toggle repo-id))]
(if (:enabled result)
;; @todo: do we really want to make this call at this moment?
(let [created-hook (github/add-webhook token login repo)]
(let [created-hook (github/add-webhook login repo token)]
(log/debug "Created webhook:" created-hook)
(github/create-label login repo token)
(repositories/update-hook-id repo-id (:id created-hook)))
(github/remove-webhook token login repo (:hook_id result)))
(github/remove-webhook login repo (:hook_id result) token))
result)))))

View File

@ -6,7 +6,8 @@
[commiteth.db.users :as users]
[commiteth.eth.core :as eth]
[ring.util.http-response :refer [ok]]
[clojure.string :refer [join]])
[clojure.string :refer [join]]
[clojure.tools.logging :as log])
(:import [java.lang Integer]))
(def label-name "bounty")
@ -27,11 +28,14 @@
(defn handle-issue-labeled
[issue]
(let [{repo-id :id} (:repository issue)
(let [{repo-id :id
repo :name
{user :login} :owner} (:repository issue)
{issue-id :id
issue-number :number
issue-title :title} (:issue issue)
created-issue (issues/create repo-id issue-id issue-number issue-title)]
(log/debug (format "Issue %s/%s/%s labeled as bounty" user repo issue-number))
(when (= 1 created-issue)
(issues/update-transaction-hash issue-id (eth/deploy-contract)))))
@ -40,6 +44,7 @@
{issue-id :id issue-number :number} :issue}]
(future
(when-let [commit-id (find-commit-id user repo issue-number "referenced")]
(log/debug (format "Issue %s/%s/%s closed with commit %s" user repo issue-number commit-id))
(issues/close commit-id issue-id))))
(def keywords
@ -93,6 +98,10 @@
(validate-issue-number owner repo))
m {:commit_id commit-id :issue_number issue-number}]
(when (or commit-id issue-number)
(log/debug (format "Pull request %s/%s/%s closed with reference to %s"
login repo pr-number
(if commit-id (str "commit-id " commit-id)
(str "issue-number " issue-number))))
(pull-requests/create (merge m {:repo_id repo-id
:pr_id id
:pr_number pr-number