]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
- logging support
authorMariusz Mazur <mmazur@pld-linux.org>
Mon, 10 Jan 2005 12:06:16 +0000 (12:06 +0000)
committerMariusz Mazur <mmazur@pld-linux.org>
Mon, 10 Jan 2005 12:06:16 +0000 (12:06 +0000)
Changed files:
    modules/cmds.py -> 1.2
    modules/ftpio.py -> 1.2

modules/cmds.py
modules/ftpio.py

index 4025ae85a6838523f029f51bfe968121def25e8a..9f3f8506e2ffbbb6d2e1444511364688b48441b8 100644 (file)
@@ -1,5 +1,10 @@
 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
 
+import os
+import time
+
+CmdError="CmdError"
+
 def parse(con):
     if '\0' not in con.data:
         return
@@ -36,7 +41,11 @@ def lock_soft(con, arg):
 def lock_hard(con, arg):
     lock(con, arg, True)
 
-CmdError="CmdError"
+logfile=open(os.environ['HOME']+'/pld-ftp-admin/var/log', 'a')
+
+def log(con, msg):
+    logfile.write('%s -- %s\n' % (time.strftime('%Y-%m-%d %H:%M:%S'), msg))
+    logfile.flush()
 
-cmdlist={'lcks':lock_soft, 'lckh':lock_hard, 'ulck':unlock}
+cmdlist={'lcks':lock_soft, 'lckh':lock_hard, 'ulck':unlock, 'log1':log}
 
index 2659d6eb74c5f262be13cc8aa14af89cf62800c8..7ccb88eaec34b1caadc451e84cf9c50b1ffefe59 100644 (file)
@@ -38,4 +38,6 @@ def lock(path, hard=False):
 def unlock(path):
     sock.send('ulck %s\0' % path)
 
+def log(msg):
+    sock.send('log1 %s\0' % msg)
 
This page took 0.067305 seconds and 4 git commands to generate.