liblogging 0.1.8__tar.gz → 0.1.10__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.
- liblogging-0.1.10/PKG-INFO +118 -0
- liblogging-0.1.10/README.md +93 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging/sending/kafka_service.py +1 -1
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging/sending/log_collector.py +3 -7
- liblogging-0.1.10/liblogging.egg-info/PKG-INFO +118 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging.egg-info/SOURCES.txt +1 -0
- liblogging-0.1.10/liblogging.egg-info/requires.txt +3 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/setup.py +6 -3
- liblogging-0.1.8/PKG-INFO +0 -49
- liblogging-0.1.8/README.md +0 -27
- liblogging-0.1.8/liblogging.egg-info/PKG-INFO +0 -49
- {liblogging-0.1.8 → liblogging-0.1.10}/LICENSE +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging/__init__.py +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging/logger.py +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging/sending/__init__.py +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging/util.py +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging.egg-info/dependency_links.txt +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging.egg-info/entry_points.txt +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging.egg-info/top_level.txt +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/liblogging.egg-info/zip-safe +0 -0
- {liblogging-0.1.8 → liblogging-0.1.10}/setup.cfg +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: liblogging
|
|
3
|
+
Version: 0.1.10
|
|
4
|
+
Summary: Utilities for logging and sending logs.
|
|
5
|
+
Home-page: https://github.com/XoriieInpottn/liblogging
|
|
6
|
+
Author: xi
|
|
7
|
+
Author-email: gylv@mail.ustc.edu.cn, huangfuyb@163.com
|
|
8
|
+
License: Apache-2.0 license
|
|
9
|
+
Platform: any
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Provides-Extra: collector
|
|
14
|
+
Requires-Dist: kafka-python==2.0.2; extra == "collector"
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: platform
|
|
23
|
+
Dynamic: provides-extra
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# liblogging
|
|
27
|
+
|
|
28
|
+
Utilities for logging and sending logs.
|
|
29
|
+
```shell
|
|
30
|
+
pip install liblogging
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 🌟Feature
|
|
34
|
+
### 统一日志格式记录
|
|
35
|
+
统一了当前agent的日志记录格式,也可自己基于默认格式进行拓展。
|
|
36
|
+
当前记录的信息和对应的key如下:
|
|
37
|
+
```python
|
|
38
|
+
{
|
|
39
|
+
"create_time": "时间戳,默认和mysql列datatime(3)保持一致",
|
|
40
|
+
"level": "like INFO, ERROR, WARNING",
|
|
41
|
+
# 通过上下文变量保存trace_id
|
|
42
|
+
"trace_id": "trace_id for 追溯不同服务的调用链路",
|
|
43
|
+
"line_info": "{record.filename}:{record.lineno}:{record.funcName}",
|
|
44
|
+
"message": message,
|
|
45
|
+
# 通过上下文变量区分不同源, 方便接收不同服务源信息, 比如Chat, Welcome, Planning等
|
|
46
|
+
"message_source": context.get("message_source", "chat_log"),
|
|
47
|
+
# 控制不同log类型,便于筛选日志数据, 比如tool, llm, turn等
|
|
48
|
+
"message_type": message_type,
|
|
49
|
+
# 可以根据自己需求加入其他的字段
|
|
50
|
+
**extra_message
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
上述日志信息均以json字符串的形式记录下来,方便存储及后续处理。
|
|
54
|
+
|
|
55
|
+
### 配置上下文变量,无须重复传参显示记录
|
|
56
|
+
通过装饰器形式, 指定需要配置的全局上下文变量, 仅需在整个程序/服务入口配置一次即可。
|
|
57
|
+
|
|
58
|
+
需要注意的是配置的全局上下文变量,根据加入装饰器下的函数入参名称匹配进行更新,推荐函数参数定义使用`BaseModel`。
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
主程序/服务: service1.py
|
|
62
|
+
from pydantic import BaseModel
|
|
63
|
+
|
|
64
|
+
from liblogging import log_request,logger
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Request(BaseModel):
|
|
68
|
+
name: str
|
|
69
|
+
trace_id: str
|
|
70
|
+
|
|
71
|
+
#在主程序入口配置了trace_id这一全局上下文变量,会通过函数入参对该字段进行赋值,后续在该服务下的其他程序logger.info时会读取这一变量并记录下来。
|
|
72
|
+
#同时也支持默认参数配置,比如message_source设置了默认值,后续使用logger会记录message_source为"demo"。
|
|
73
|
+
@log_request("trace_id", message_source="demo")
|
|
74
|
+
def your_service_entry(request: Request):
|
|
75
|
+
logger.info("Processing request")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
该服务下的其他程序: function1.py,可直接logger.info(). trace_id, message_source均会记录下来。
|
|
80
|
+
from liblogging import logger
|
|
81
|
+
|
|
82
|
+
def test(name):
|
|
83
|
+
logger.info(f"Testing {name}")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 重定向并发送到消息队列
|
|
87
|
+
以默认集成的kafka为例,可将上述统一日志格式记录的形式发送至kafka。
|
|
88
|
+
|
|
89
|
+
kafka 配置文件格式:
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"{cluster_name}": {
|
|
93
|
+
"{env_name}": {
|
|
94
|
+
"bootstrap_servers": "server1, server2, server3",
|
|
95
|
+
"username": "username",
|
|
96
|
+
"password": "******",
|
|
97
|
+
"topic": "your topic",
|
|
98
|
+
"...": "..."
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
使用形式:
|
|
105
|
+
```shell
|
|
106
|
+
python service 2>&1 | tee {log_file_path} | liblogging_collector --config-path {your_kafka_path} --ssl-cafile {your_ssl_cafile_path} --send-kafka
|
|
107
|
+
```
|
|
108
|
+
tee {log_file_path} 可以将你的程序记录(输出+错误)重定向到文件中(可选)。
|
|
109
|
+
[log_collector.py](liblogging/sending/log_collector.py)为`liblogging_collector`的源代码地址。
|
|
110
|
+
`env_name`不指定的话,默认读取`os.environ.get("CHAT_ENV", "dev")`
|
|
111
|
+
|
|
112
|
+
## 📋Example
|
|
113
|
+
增加额外记录字段信息,以及搭配[libentry](https://github.com/XoriieInpottn/libentry)使用的样例见 [example](example)。
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## 💡Tips
|
|
117
|
+
|
|
118
|
+
1. If using Kafka to send messages, please use `pip install liblogging[collector]`.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# liblogging
|
|
2
|
+
|
|
3
|
+
Utilities for logging and sending logs.
|
|
4
|
+
```shell
|
|
5
|
+
pip install liblogging
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## 🌟Feature
|
|
9
|
+
### 统一日志格式记录
|
|
10
|
+
统一了当前agent的日志记录格式,也可自己基于默认格式进行拓展。
|
|
11
|
+
当前记录的信息和对应的key如下:
|
|
12
|
+
```python
|
|
13
|
+
{
|
|
14
|
+
"create_time": "时间戳,默认和mysql列datatime(3)保持一致",
|
|
15
|
+
"level": "like INFO, ERROR, WARNING",
|
|
16
|
+
# 通过上下文变量保存trace_id
|
|
17
|
+
"trace_id": "trace_id for 追溯不同服务的调用链路",
|
|
18
|
+
"line_info": "{record.filename}:{record.lineno}:{record.funcName}",
|
|
19
|
+
"message": message,
|
|
20
|
+
# 通过上下文变量区分不同源, 方便接收不同服务源信息, 比如Chat, Welcome, Planning等
|
|
21
|
+
"message_source": context.get("message_source", "chat_log"),
|
|
22
|
+
# 控制不同log类型,便于筛选日志数据, 比如tool, llm, turn等
|
|
23
|
+
"message_type": message_type,
|
|
24
|
+
# 可以根据自己需求加入其他的字段
|
|
25
|
+
**extra_message
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
上述日志信息均以json字符串的形式记录下来,方便存储及后续处理。
|
|
29
|
+
|
|
30
|
+
### 配置上下文变量,无须重复传参显示记录
|
|
31
|
+
通过装饰器形式, 指定需要配置的全局上下文变量, 仅需在整个程序/服务入口配置一次即可。
|
|
32
|
+
|
|
33
|
+
需要注意的是配置的全局上下文变量,根据加入装饰器下的函数入参名称匹配进行更新,推荐函数参数定义使用`BaseModel`。
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
主程序/服务: service1.py
|
|
37
|
+
from pydantic import BaseModel
|
|
38
|
+
|
|
39
|
+
from liblogging import log_request,logger
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Request(BaseModel):
|
|
43
|
+
name: str
|
|
44
|
+
trace_id: str
|
|
45
|
+
|
|
46
|
+
#在主程序入口配置了trace_id这一全局上下文变量,会通过函数入参对该字段进行赋值,后续在该服务下的其他程序logger.info时会读取这一变量并记录下来。
|
|
47
|
+
#同时也支持默认参数配置,比如message_source设置了默认值,后续使用logger会记录message_source为"demo"。
|
|
48
|
+
@log_request("trace_id", message_source="demo")
|
|
49
|
+
def your_service_entry(request: Request):
|
|
50
|
+
logger.info("Processing request")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
该服务下的其他程序: function1.py,可直接logger.info(). trace_id, message_source均会记录下来。
|
|
55
|
+
from liblogging import logger
|
|
56
|
+
|
|
57
|
+
def test(name):
|
|
58
|
+
logger.info(f"Testing {name}")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 重定向并发送到消息队列
|
|
62
|
+
以默认集成的kafka为例,可将上述统一日志格式记录的形式发送至kafka。
|
|
63
|
+
|
|
64
|
+
kafka 配置文件格式:
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"{cluster_name}": {
|
|
68
|
+
"{env_name}": {
|
|
69
|
+
"bootstrap_servers": "server1, server2, server3",
|
|
70
|
+
"username": "username",
|
|
71
|
+
"password": "******",
|
|
72
|
+
"topic": "your topic",
|
|
73
|
+
"...": "..."
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
使用形式:
|
|
80
|
+
```shell
|
|
81
|
+
python service 2>&1 | tee {log_file_path} | liblogging_collector --config-path {your_kafka_path} --ssl-cafile {your_ssl_cafile_path} --send-kafka
|
|
82
|
+
```
|
|
83
|
+
tee {log_file_path} 可以将你的程序记录(输出+错误)重定向到文件中(可选)。
|
|
84
|
+
[log_collector.py](liblogging/sending/log_collector.py)为`liblogging_collector`的源代码地址。
|
|
85
|
+
`env_name`不指定的话,默认读取`os.environ.get("CHAT_ENV", "dev")`
|
|
86
|
+
|
|
87
|
+
## 📋Example
|
|
88
|
+
增加额外记录字段信息,以及搭配[libentry](https://github.com/XoriieInpottn/libentry)使用的样例见 [example](example)。
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## 💡Tips
|
|
92
|
+
|
|
93
|
+
1. If using Kafka to send messages, please use `pip install liblogging[collector]`.
|
|
@@ -51,22 +51,18 @@ class LogCollector:
|
|
|
51
51
|
def collect(
|
|
52
52
|
self, send_kafka: bool = False, chat_env: str = "dev", use_default_process: bool = True
|
|
53
53
|
):
|
|
54
|
-
start_time = time.time()
|
|
55
54
|
while True:
|
|
56
55
|
try:
|
|
57
56
|
line = sys.stdin.readline().strip()
|
|
58
57
|
if not line:
|
|
59
58
|
continue
|
|
60
|
-
print(line)
|
|
61
|
-
print(round(time.time() - start_time, 3))
|
|
62
|
-
start_time = time.time()
|
|
63
59
|
try:
|
|
64
60
|
if use_default_process:
|
|
65
61
|
trace_id, message = process_message(line)
|
|
66
62
|
else:
|
|
67
63
|
message = json.loads(line)
|
|
68
64
|
trace_id = message.get("trace_id", "")
|
|
69
|
-
|
|
65
|
+
print(message)
|
|
70
66
|
if send_kafka and trace_id:
|
|
71
67
|
print(f"Sending kafka message. env:{chat_env}")
|
|
72
68
|
thread_pool_manager.submit(
|
|
@@ -78,8 +74,8 @@ class LogCollector:
|
|
|
78
74
|
key=trace_id,
|
|
79
75
|
source=message.get("message_source")
|
|
80
76
|
)
|
|
81
|
-
except ValueError
|
|
82
|
-
|
|
77
|
+
except ValueError:
|
|
78
|
+
print(line)
|
|
83
79
|
|
|
84
80
|
except EOFError:
|
|
85
81
|
print("End of input reached. Exiting...", file=sys.stderr)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: liblogging
|
|
3
|
+
Version: 0.1.10
|
|
4
|
+
Summary: Utilities for logging and sending logs.
|
|
5
|
+
Home-page: https://github.com/XoriieInpottn/liblogging
|
|
6
|
+
Author: xi
|
|
7
|
+
Author-email: gylv@mail.ustc.edu.cn, huangfuyb@163.com
|
|
8
|
+
License: Apache-2.0 license
|
|
9
|
+
Platform: any
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Provides-Extra: collector
|
|
14
|
+
Requires-Dist: kafka-python==2.0.2; extra == "collector"
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: platform
|
|
23
|
+
Dynamic: provides-extra
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# liblogging
|
|
27
|
+
|
|
28
|
+
Utilities for logging and sending logs.
|
|
29
|
+
```shell
|
|
30
|
+
pip install liblogging
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 🌟Feature
|
|
34
|
+
### 统一日志格式记录
|
|
35
|
+
统一了当前agent的日志记录格式,也可自己基于默认格式进行拓展。
|
|
36
|
+
当前记录的信息和对应的key如下:
|
|
37
|
+
```python
|
|
38
|
+
{
|
|
39
|
+
"create_time": "时间戳,默认和mysql列datatime(3)保持一致",
|
|
40
|
+
"level": "like INFO, ERROR, WARNING",
|
|
41
|
+
# 通过上下文变量保存trace_id
|
|
42
|
+
"trace_id": "trace_id for 追溯不同服务的调用链路",
|
|
43
|
+
"line_info": "{record.filename}:{record.lineno}:{record.funcName}",
|
|
44
|
+
"message": message,
|
|
45
|
+
# 通过上下文变量区分不同源, 方便接收不同服务源信息, 比如Chat, Welcome, Planning等
|
|
46
|
+
"message_source": context.get("message_source", "chat_log"),
|
|
47
|
+
# 控制不同log类型,便于筛选日志数据, 比如tool, llm, turn等
|
|
48
|
+
"message_type": message_type,
|
|
49
|
+
# 可以根据自己需求加入其他的字段
|
|
50
|
+
**extra_message
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
上述日志信息均以json字符串的形式记录下来,方便存储及后续处理。
|
|
54
|
+
|
|
55
|
+
### 配置上下文变量,无须重复传参显示记录
|
|
56
|
+
通过装饰器形式, 指定需要配置的全局上下文变量, 仅需在整个程序/服务入口配置一次即可。
|
|
57
|
+
|
|
58
|
+
需要注意的是配置的全局上下文变量,根据加入装饰器下的函数入参名称匹配进行更新,推荐函数参数定义使用`BaseModel`。
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
主程序/服务: service1.py
|
|
62
|
+
from pydantic import BaseModel
|
|
63
|
+
|
|
64
|
+
from liblogging import log_request,logger
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Request(BaseModel):
|
|
68
|
+
name: str
|
|
69
|
+
trace_id: str
|
|
70
|
+
|
|
71
|
+
#在主程序入口配置了trace_id这一全局上下文变量,会通过函数入参对该字段进行赋值,后续在该服务下的其他程序logger.info时会读取这一变量并记录下来。
|
|
72
|
+
#同时也支持默认参数配置,比如message_source设置了默认值,后续使用logger会记录message_source为"demo"。
|
|
73
|
+
@log_request("trace_id", message_source="demo")
|
|
74
|
+
def your_service_entry(request: Request):
|
|
75
|
+
logger.info("Processing request")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
该服务下的其他程序: function1.py,可直接logger.info(). trace_id, message_source均会记录下来。
|
|
80
|
+
from liblogging import logger
|
|
81
|
+
|
|
82
|
+
def test(name):
|
|
83
|
+
logger.info(f"Testing {name}")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 重定向并发送到消息队列
|
|
87
|
+
以默认集成的kafka为例,可将上述统一日志格式记录的形式发送至kafka。
|
|
88
|
+
|
|
89
|
+
kafka 配置文件格式:
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"{cluster_name}": {
|
|
93
|
+
"{env_name}": {
|
|
94
|
+
"bootstrap_servers": "server1, server2, server3",
|
|
95
|
+
"username": "username",
|
|
96
|
+
"password": "******",
|
|
97
|
+
"topic": "your topic",
|
|
98
|
+
"...": "..."
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
使用形式:
|
|
105
|
+
```shell
|
|
106
|
+
python service 2>&1 | tee {log_file_path} | liblogging_collector --config-path {your_kafka_path} --ssl-cafile {your_ssl_cafile_path} --send-kafka
|
|
107
|
+
```
|
|
108
|
+
tee {log_file_path} 可以将你的程序记录(输出+错误)重定向到文件中(可选)。
|
|
109
|
+
[log_collector.py](liblogging/sending/log_collector.py)为`liblogging_collector`的源代码地址。
|
|
110
|
+
`env_name`不指定的话,默认读取`os.environ.get("CHAT_ENV", "dev")`
|
|
111
|
+
|
|
112
|
+
## 📋Example
|
|
113
|
+
增加额外记录字段信息,以及搭配[libentry](https://github.com/XoriieInpottn/libentry)使用的样例见 [example](example)。
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## 💡Tips
|
|
117
|
+
|
|
118
|
+
1. If using Kafka to send messages, please use `pip install liblogging[collector]`.
|
|
@@ -8,6 +8,7 @@ liblogging.egg-info/PKG-INFO
|
|
|
8
8
|
liblogging.egg-info/SOURCES.txt
|
|
9
9
|
liblogging.egg-info/dependency_links.txt
|
|
10
10
|
liblogging.egg-info/entry_points.txt
|
|
11
|
+
liblogging.egg-info/requires.txt
|
|
11
12
|
liblogging.egg-info/top_level.txt
|
|
12
13
|
liblogging.egg-info/zip-safe
|
|
13
14
|
liblogging/sending/__init__.py
|
|
@@ -18,13 +18,13 @@ if __name__ == '__main__':
|
|
|
18
18
|
'liblogging_collector = liblogging.sending.log_collector:main'
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
|
-
version='0.1.
|
|
21
|
+
version='0.1.10',
|
|
22
22
|
description='Utilities for logging and sending logs.',
|
|
23
23
|
long_description_content_type='text/markdown',
|
|
24
24
|
long_description=long_description,
|
|
25
25
|
license='Apache-2.0 license',
|
|
26
26
|
author='xi',
|
|
27
|
-
author_email='gylv@mail.ustc.edu.cn',
|
|
27
|
+
author_email='gylv@mail.ustc.edu.cn, huangfuyb@163.com',
|
|
28
28
|
url='https://github.com/XoriieInpottn/liblogging',
|
|
29
29
|
platforms='any',
|
|
30
30
|
classifiers=[
|
|
@@ -32,5 +32,8 @@ if __name__ == '__main__':
|
|
|
32
32
|
],
|
|
33
33
|
include_package_data=True,
|
|
34
34
|
zip_safe=True,
|
|
35
|
-
install_requires=[]
|
|
35
|
+
install_requires=[],
|
|
36
|
+
extras_require={
|
|
37
|
+
'collector': ['kafka-python==2.0.2']
|
|
38
|
+
}
|
|
36
39
|
)
|
liblogging-0.1.8/PKG-INFO
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: liblogging
|
|
3
|
-
Version: 0.1.8
|
|
4
|
-
Summary: Utilities for logging and sending logs.
|
|
5
|
-
Home-page: https://github.com/XoriieInpottn/liblogging
|
|
6
|
-
Author: xi
|
|
7
|
-
Author-email: gylv@mail.ustc.edu.cn
|
|
8
|
-
License: Apache-2.0 license
|
|
9
|
-
Platform: any
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Dynamic: author
|
|
14
|
-
Dynamic: author-email
|
|
15
|
-
Dynamic: classifier
|
|
16
|
-
Dynamic: description
|
|
17
|
-
Dynamic: description-content-type
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: license
|
|
20
|
-
Dynamic: platform
|
|
21
|
-
Dynamic: summary
|
|
22
|
-
|
|
23
|
-
# liblogging
|
|
24
|
-
|
|
25
|
-
Utilities for logging and sending logs.
|
|
26
|
-
|
|
27
|
-
# Usage
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
from liblogging.logger import logger
|
|
31
|
-
|
|
32
|
-
# Log a simple message
|
|
33
|
-
logger.info("This is an info message")
|
|
34
|
-
|
|
35
|
-
# Log a message with context
|
|
36
|
-
logger.track_start("Starting process", message_type="process_start")
|
|
37
|
-
logger.track_end("Ending process", message_type="process_end")
|
|
38
|
-
|
|
39
|
-
# Log a request
|
|
40
|
-
@log_request("user_id", "session_id")
|
|
41
|
-
def process_request(user_id, session_id):
|
|
42
|
-
logger.info("Processing request")
|
|
43
|
-
|
|
44
|
-
process_request(user_id=123, session_id="abc")
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
# Tips
|
|
48
|
-
|
|
49
|
-
1. If using Kafka to send messages, please use `kafka-python==2.0.2`.
|
liblogging-0.1.8/README.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# liblogging
|
|
2
|
-
|
|
3
|
-
Utilities for logging and sending logs.
|
|
4
|
-
|
|
5
|
-
# Usage
|
|
6
|
-
|
|
7
|
-
```python
|
|
8
|
-
from liblogging.logger import logger
|
|
9
|
-
|
|
10
|
-
# Log a simple message
|
|
11
|
-
logger.info("This is an info message")
|
|
12
|
-
|
|
13
|
-
# Log a message with context
|
|
14
|
-
logger.track_start("Starting process", message_type="process_start")
|
|
15
|
-
logger.track_end("Ending process", message_type="process_end")
|
|
16
|
-
|
|
17
|
-
# Log a request
|
|
18
|
-
@log_request("user_id", "session_id")
|
|
19
|
-
def process_request(user_id, session_id):
|
|
20
|
-
logger.info("Processing request")
|
|
21
|
-
|
|
22
|
-
process_request(user_id=123, session_id="abc")
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
# Tips
|
|
26
|
-
|
|
27
|
-
1. If using Kafka to send messages, please use `kafka-python==2.0.2`.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: liblogging
|
|
3
|
-
Version: 0.1.8
|
|
4
|
-
Summary: Utilities for logging and sending logs.
|
|
5
|
-
Home-page: https://github.com/XoriieInpottn/liblogging
|
|
6
|
-
Author: xi
|
|
7
|
-
Author-email: gylv@mail.ustc.edu.cn
|
|
8
|
-
License: Apache-2.0 license
|
|
9
|
-
Platform: any
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Dynamic: author
|
|
14
|
-
Dynamic: author-email
|
|
15
|
-
Dynamic: classifier
|
|
16
|
-
Dynamic: description
|
|
17
|
-
Dynamic: description-content-type
|
|
18
|
-
Dynamic: home-page
|
|
19
|
-
Dynamic: license
|
|
20
|
-
Dynamic: platform
|
|
21
|
-
Dynamic: summary
|
|
22
|
-
|
|
23
|
-
# liblogging
|
|
24
|
-
|
|
25
|
-
Utilities for logging and sending logs.
|
|
26
|
-
|
|
27
|
-
# Usage
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
from liblogging.logger import logger
|
|
31
|
-
|
|
32
|
-
# Log a simple message
|
|
33
|
-
logger.info("This is an info message")
|
|
34
|
-
|
|
35
|
-
# Log a message with context
|
|
36
|
-
logger.track_start("Starting process", message_type="process_start")
|
|
37
|
-
logger.track_end("Ending process", message_type="process_end")
|
|
38
|
-
|
|
39
|
-
# Log a request
|
|
40
|
-
@log_request("user_id", "session_id")
|
|
41
|
-
def process_request(user_id, session_id):
|
|
42
|
-
logger.info("Processing request")
|
|
43
|
-
|
|
44
|
-
process_request(user_id=123, session_id="abc")
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
# Tips
|
|
48
|
-
|
|
49
|
-
1. If using Kafka to send messages, please use `kafka-python==2.0.2`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|