Log to runtime script path.

This commit is contained in:
nikolark committed 2011-09-18 01:45:59 +02:00
1 parent 847def1481
commit d99df30f77
2 files changed
+9 -3

No files matched your search

+2
View File
@@ -1 +1,3 @@
send_to_web.sh
*.swp
*.pyc
+7 -3
View File
@@ -1,6 +1,7 @@
import web
import simplejson as json
import urllib
import os
import simplejson as json
import web
from datetime import datetime
from subprocess import Popen
from socket import socket, AF_INET, SOCK_DGRAM
@@ -22,6 +23,9 @@ class ping:
WEB_PATH = '/var/www/neuf.no/new/'
ALLOWED_REPO_URLS = ['https://github.com/neuf/main',]
def script_path(self):
return os.path.dirname(os.path.abspath(__file__))
def POST(self):
post_data = web.input()
try:
@@ -70,7 +74,7 @@ class ping:
def log(self, msg):
# Log pings.
log = open("/opt/github-hooks-recieve/pings.log", "a+")
log = open(self.script_path() + "pings.log", "a+")
log.write(datetime.now().isoformat() + ": " + msg + "\n")
log.close()