OSDN Git Service

implement encode tester.
[rec10/rec10-git.git] / rec10 / trunk / src / recdblist.py
index a694ca0..b673a94 100644 (file)
@@ -6,6 +6,8 @@
 """
 task names
 """
+import datetime
+import os
 import os.path
 
 global REC_RESERVE
@@ -68,9 +70,37 @@ REC_AUTO_SUGGEST_AP2FP = "auto_suggest_ap2fp"
 REC_AUTO_KEYWORD = "auto_keyword"
 REC_BAYES_SUGGEST ="bayes_suggest"
 
-version = 94
+version = 96
+version_str="0.9.6"
 def printutf8(unicode):
-    print unicode.encode('utf-8')
+    str=unicode.encode('utf-8')
+    print str
+def printuft8ex(unicode):
+    str=unicode.encode('utf-8')
+    print str
+    logfname="/var/log/rec10"
+    mode="a"
+    if os.path.exists(logfname):
+        f=open(logfname,mode)
+        f.write(str+"\n")
+        f.close()
+def Commonlogex(type,place,inst,txt=""):
+    lt=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+u":"
+    if txt=="":
+        lt=lt+u"["+type+u"] "+place+u" "+inst
+    else:
+        lt=lt+u"["+type+u"] "+place+u" "+inst+u"\n"+txt
+    lt=lt.encode('utf-8')
+    logfname="/var/log/rec10"
+    mode="a"
+    print lt
+    if os.path.exists(logfname):
+        f=open(logfname,mode)
+        f.write(lt+"\n")
+        f.close()
+def addCommandLog(tspath,log_title,cmd,cmd_log=""):
+    addlog(tspath,cmd,log_title+u"ログ-コマンド")
+    addlog(tspath,cmd_log,log_title+u"ログ-詳細")
 def addlog(tspath,txt,log_title):
     logo=tspath
     logo=logo.replace("_1.wav",".ts")
@@ -101,6 +131,7 @@ def addlog(tspath,txt,log_title):
             stxt=stxt+txt[s-800+st:]
     else:
         stxt=txt
-    txtw="\n####"+log_title+"####\n"+stxt
+    txtw= datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+    txtw=txtw+"\n####"+log_title+"####\n"+stxt
     f.write(txtw.encode('utf-8'))
     f.close()
\ No newline at end of file