COM.gstrYMDHMS, name) f.write(data) rc = 0 except Exception as e: LOG.writeLn("[jsonAppend ERROR]: %s" % e) return rc # 프로그램 시작 GLOB.directoryInit('pi', "DOORs") path = COM.gHomeDir + "faces/" faceLogPath = COM.gHomeDir + "facelog/" metrixImg = COM.gHomeDir + "metrix.png" GLOB.folderMaker(path) GLOB.folderMaker(faceLogPath) GLOB.folderMaker(COM.gJsonDir) #from frogmon.ulogger import LOG configFileNM = COM.gHomeDir + COM.gSetupFile controlFileNM = COM.gHomeDir + COM.gControlFile user_id = GLOB.readConfig(configFileNM, 'SETUP', 'user_id', '0') dev_id = GLOB.readConfig(configFileNM, 'AGENT', 'id', '0') file_list = os.listdir(path) known_face_names = [] known_face_encodings = [] for i in file_list:
# 프로그램 시작 GLOB.directoryInit(GLOB.whoami(), "DOORs") configFileNM = COM.gHomeDir + COM.gSetupFile controlFileNM = COM.gHomeDir + COM.gControlFile user_id = GLOB.readConfig(configFileNM, 'SETUP', 'user_id', '0') dev_id = GLOB.readConfig(configFileNM, 'AGENT', 'id', '0') # 함수 정의 mWhoami = GLOB.whoami() mUsbDir = "/mnt/usb_stick" mFaceDir = COM.gHomeDir + "faces/" GLOB.folderMaker(mFaceDir) print("whoami = %s" % mWhoami) print("usb dir = %s" % mUsbDir) print("face home dir = %s" % mFaceDir) mSourcePath = [] def usbDir(): return os.listdir(mUsbDir) def copyFileList(srcPath, destPath): print("copyFileList (%s=>%s)" % (srcPath, destPath)) if not GLOB.folderExitst(srcPath):
# uLogger.py #-*- coding:utf-8 -*- import sys import logging import logging.handlers import sdnotify from frogmon.uCommon import COM from frogmon.uGlobal import GLOB from unidecode import unidecode from colorama import Fore, Back, Style GLOB.folderMaker(COM.gLogDir) #logger instance create logger = logging.getLogger(__name__) #logger formatter create formatter = logging.Formatter('[%(asctime)s] %(message)s') #handler create (stream, file) streamHandler = logging.StreamHandler() fileHandler = logging.FileHandler(COM.gLogDir + 'syslog_%s.log' % COM.gstrYMD) #logger instance에 fomatter create streamHandler.setFormatter(formatter) fileHandler.setFormatter(formatter) #logger instance에 handler create logger.addHandler(streamHandler) logger.addHandler(fileHandler) #Log Level Setting