shadowshell 0.0.32__tar.gz → 0.0.34__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowshell
3
- Version: 0.0.32
3
+ Version: 0.0.34
4
4
  Summary: www.shadowshell.xyz
5
5
  Author-email: shadowshell <shadowshellxyz@foxmail.com>
6
6
  License: MIT
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "shadowshell" # 全局唯一名称(检查PyPI是否被占用)
7
7
  #version = "0.0.24" # 版本号(每次更新需递增)
8
- version = "0.0.32" # 版本号(每次更新需递增)
8
+ version = "0.0.34" # 版本号(每次更新需递增)
9
9
  authors = [{ name = "shadowshell", email = "shadowshellxyz@foxmail.com" }]
10
10
  description = "www.shadowshell.xyz"
11
11
  readme = "README.md"
@@ -77,24 +77,29 @@ def performance_monitor(func):
77
77
  start = time.perf_counter()
78
78
  result = func(*args, **kwargs)
79
79
  elapsed = time.perf_counter() - start
80
- logger.info(f"[PERFORMANCE_MONITOR][{func.__name__}] has ran, time elapsed:{elapsed:.6f} s.")
80
+ logger.info(f"[PERFORMANCE_MONITOR][{func.__name__}] has ran, time elapsed:{elapsed:.6f}s.")
81
81
  return result
82
82
  return wrapper
83
83
 
84
- def function_monitor(func):
85
- def wrapper(*args, **kwargs):
86
- start = time.perf_counter()
87
- try:
88
- result = func(*args, **kwargs)
89
- except Exception as e:
90
- logger.error(e)
91
- except:
92
- logger.error(sys.exc_info()[0])
93
- finally:
94
- elapsed = time.perf_counter() - start
95
- logger.info(f"[FUNCTION_MONITOR][{func.__name__}] has ran, time elapsed:{elapsed:.6f} s.")
96
- return result
97
- return wrapper
84
+ def function_monitor(clazz=None):
85
+ def decorator(func):
86
+ def wrapper(*args, **kwargs):
87
+ start = time.perf_counter()
88
+ try:
89
+ result = func(*args, **kwargs)
90
+ except Exception as e:
91
+ logger.error(e)
92
+ except:
93
+ logger.error(sys.exc_info()[0])
94
+ finally:
95
+ elapsed = time.perf_counter() - start
96
+ if (clazz is not None):
97
+ logger.info(f"[FUNCTION_MONITOR][{clazz.__name__}][{func.__name__}] has ran, time elapsed:{elapsed:.6f}s.")
98
+ else:
99
+ logger.info(f"[FUNCTION_MONITOR][{func.__name__}] has ran, time elapsed:{elapsed:.6f}s.")
100
+ return result
101
+ return wrapper
102
+ return decorator
98
103
 
99
104
  def testserver():
100
105
  os.system("ping shadowshell.xyz")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowshell
3
- Version: 0.0.32
3
+ Version: 0.0.34
4
4
  Summary: www.shadowshell.xyz
5
5
  Author-email: shadowshell <shadowshellxyz@foxmail.com>
6
6
  License: MIT
File without changes
File without changes