!59 add loger interface function
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
1031f87e8e
58
0006-add-loger-interface-function.patc
Normal file
58
0006-add-loger-interface-function.patc
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From 0d0a26ccedd820a583e4579d240542e346e459f3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lixin <lixinb@uniontech.com>
|
||||||
|
Date: Tue, 7 Nov 2023 11:05:17 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=A5=E5=BF=97=E5=8A=9F?=
|
||||||
|
=?UTF-8?q?=E8=83=BD?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
logger.py | 34 ++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 34 insertions(+)
|
||||||
|
create mode 100644 logger.py
|
||||||
|
|
||||||
|
diff --git a/logger.py b/logger.py
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..2bdd144
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/logger.py
|
||||||
|
@@ -0,0 +1,34 @@
|
||||||
|
+# -*-coding:UTF-8-*-
|
||||||
|
+
|
||||||
|
+import logging
|
||||||
|
+
|
||||||
|
+class Logger:
|
||||||
|
+ def __init__(self, path,clevel = logging.DEBUG,Flevel = logging.DEBUG):
|
||||||
|
+ self.logger = logging.getLogger(path)
|
||||||
|
+ self.logger.setLevel(logging.DEBUG)
|
||||||
|
+ fmt = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s', '%Y-%m-%d %H:%M:%S')
|
||||||
|
+ #设置CMD日志
|
||||||
|
+ sh = logging.StreamHandler()
|
||||||
|
+ sh.setFormatter(fmt)
|
||||||
|
+ sh.setLevel(clevel)
|
||||||
|
+ #设置文件日志
|
||||||
|
+ fh = logging.FileHandler(path)
|
||||||
|
+ fh.setFormatter(fmt)
|
||||||
|
+ fh.setLevel(Flevel)
|
||||||
|
+ self.logger.addHandler(sh)
|
||||||
|
+ self.logger.addHandler(fh)
|
||||||
|
+
|
||||||
|
+ def debug(self,message):
|
||||||
|
+ self.logger.debug(message)
|
||||||
|
+
|
||||||
|
+ def info(self,message):
|
||||||
|
+ self.logger.info(message)
|
||||||
|
+
|
||||||
|
+ def war(self,message):
|
||||||
|
+ self.logger.warning(message)
|
||||||
|
+
|
||||||
|
+ def error(self,message):
|
||||||
|
+ self.logger.error(message)
|
||||||
|
+
|
||||||
|
+ def cri(self,message):
|
||||||
|
+ self.logger.critical(message)
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 5
|
Release: 6
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
@ -12,6 +12,7 @@ Patch1: 0002-modify-excel-report-content.patch
|
|||||||
Patch2: 0003-delete-redundant-code.patch
|
Patch2: 0003-delete-redundant-code.patch
|
||||||
Patch3: 0004-connect-sql-function.patch
|
Patch3: 0004-connect-sql-function.patch
|
||||||
Patch4: 0005-execution-sql-function.patch
|
Patch4: 0005-execution-sql-function.patch
|
||||||
|
Patch5: 0006-add-loger-interface-function.patc
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
@ -110,6 +111,9 @@ rm -rf /usr/bin/migration-tools
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 4 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-6
|
||||||
|
- 0006-add-loger-interface-function.patc
|
||||||
|
|
||||||
* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-5
|
* Fri Nov 1 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-5
|
||||||
- add 0005-execution-sql-function.patch
|
- add 0005-execution-sql-function.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user