Ticket #804: Move log
Also emit less logs on the console by default. Log file still contains the full output.ticket-769
parent
9a198ec49b
commit
e76b79090d
|
@ -1423,7 +1423,7 @@ class OpengnsysGitLibrary:
|
|||
|
||||
add_files = add_files_new
|
||||
|
||||
self.logger.debug("Adding %d files" % len(add_files))
|
||||
self.logger.info("Adding %d files" % len(add_files))
|
||||
with OperationTimer(self, "add all files"):
|
||||
#subprocess.run(["git", "add"] + add_files, check=True, cwd=path)
|
||||
repo.index.add(items = add_files, force=True )
|
||||
|
@ -1441,7 +1441,7 @@ class OpengnsysGitLibrary:
|
|||
subprocess.run(["git", "add"] + untracked_list, check=True, cwd=path)
|
||||
|
||||
|
||||
self.logger.debug("Committing")
|
||||
self.logger.info("Committing")
|
||||
repo.index.commit("Initial commit")
|
||||
|
||||
# Restaurar cosas modificadas para git
|
||||
|
@ -1466,7 +1466,7 @@ class OpengnsysGitLibrary:
|
|||
# repo.create_head
|
||||
# repo.heads.master.set_tracking_branch(origin.refs.master)
|
||||
|
||||
self.logger.debug("Uploading to ogrepository")
|
||||
self.logger.info("Uploading to ogrepository")
|
||||
repo.git.push("--set-upstream", "origin", repo.head.ref, "--force") # force = True)
|
||||
|
||||
def cloneRepo(self, repo_name, destination, boot_device):
|
||||
|
@ -1597,13 +1597,18 @@ if __name__ == '__main__':
|
|||
# esto arregla las tildes y las eñes
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
opengnsys_log_dir = "/opt/opengnsys/log"
|
||||
|
||||
logger = logging.getLogger(__package__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
streamLog = logging.StreamHandler()
|
||||
streamLog.setLevel(logging.DEBUG)
|
||||
streamLog.setLevel(logging.INFO)
|
||||
|
||||
fileLog = logging.FileHandler("gitlib.log")
|
||||
if not os.path.exists(opengnsys_log_dir):
|
||||
os.mkdir(opengnsys_log_dir)
|
||||
|
||||
fileLog = logging.FileHandler(f"{opengnsys_log_dir}/gitlib.log")
|
||||
fileLog.setLevel(logging.DEBUG)
|
||||
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)24s - [%(levelname)5s] - %(message)s')
|
||||
|
@ -1637,12 +1642,15 @@ if __name__ == '__main__':
|
|||
parser.add_argument("--test-restore-metadata-destructive", type=str, metavar="DIR", help="Test metadata restoration, destructive parts only")
|
||||
parser.add_argument("--test-clone-metadata", type=str, metavar="REPO", help="Test metadata cloning")
|
||||
|
||||
parser.add_argument("-v", "--verbose", action="store_true", help = "Verbose console output")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.verbose:
|
||||
streamLog.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
logger.debug("Inicio")
|
||||
logger.debug("Starting")
|
||||
|
||||
ntfs_impl = NTFSImplementation.Kernel
|
||||
|
||||
|
|
Loading…
Reference in New Issue