yearning-cli 0.1.9__tar.gz → 0.2.0__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.
@@ -20,20 +20,20 @@ jobs:
20
20
  uses: actions/checkout@v6
21
21
 
22
22
  - name: Set up QEMU
23
- uses: docker/setup-qemu-action@v3
23
+ uses: docker/setup-qemu-action@v4
24
24
 
25
25
  - name: Set up Docker Buildx
26
- uses: docker/setup-buildx-action@v3
26
+ uses: docker/setup-buildx-action@v4
27
27
 
28
28
  - name: Login to Docker Hub
29
- uses: docker/login-action@v3
29
+ uses: docker/login-action@v4
30
30
  with:
31
31
  username: ${{ secrets.DOCKERHUB_USERNAME }}
32
32
  password: ${{ secrets.DOCKERHUB_TOKEN }}
33
33
 
34
34
  - name: Docker metadata
35
35
  id: meta
36
- uses: docker/metadata-action@v5
36
+ uses: docker/metadata-action@v6
37
37
  with:
38
38
  images: ${{ env.IMAGE_NAME }}
39
39
  tags: |
@@ -41,7 +41,7 @@ jobs:
41
41
  type=raw,value=latest
42
42
 
43
43
  - name: Build and push
44
- uses: docker/build-push-action@v6
44
+ uses: docker/build-push-action@v7
45
45
  with:
46
46
  context: .
47
47
  file: ./Dockerfile
@@ -2,6 +2,7 @@ FROM python:3.14-slim
2
2
 
3
3
  ENV PYTHONUNBUFFERED=1 \
4
4
  PIP_NO_CACHE_DIR=1 \
5
+ TZ=Asia/Shanghai \
5
6
  SQL_PROXY_HOST=0.0.0.0 \
6
7
  SQL_PROXY_PORT=3307
7
8
 
@@ -18,7 +19,7 @@ EXPOSE 3307
18
19
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
19
20
  CMD python -c "import os, socket; s=socket.create_connection(('127.0.0.1', int(os.getenv('SQL_PROXY_PORT', '3307'))), 3); s.close()"
20
21
 
21
- CMD sql proxy \
22
+ CMD sql proxy -v \
22
23
  --host "${SQL_PROXY_HOST}" \
23
24
  --port "${SQL_PROXY_PORT}" \
24
25
  ${SQL_PROXY_SOURCE:+--source "$SQL_PROXY_SOURCE"} \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yearning-cli
3
- Version: 0.1.9
3
+ Version: 0.2.0
4
4
  Summary: Yearning MySQL Audit Platform CLI Tool
5
5
  Project-URL: Homepage, https://github.com/la3rence/yearning-cli
6
6
  Project-URL: Repository, https://github.com/la3rence/yearning-cli
@@ -12,6 +12,7 @@ services:
12
12
  YEARNING_URL: "${YEARNING_URL:-http://192.168.1.135}"
13
13
  YEARNING_USER: "${YEARNING_USER:-}"
14
14
  YEARNING_PASS: "${YEARNING_PASS:-}"
15
+ TZ: "Asia/Shanghai"
15
16
  SQL_PROXY_HOST: "0.0.0.0"
16
17
  SQL_PROXY_PORT: "${SQL_PROXY_PORT:-3307}"
17
18
  SQL_PROXY_SOURCE: "${SQL_PROXY_SOURCE:-}"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "yearning-cli"
3
- version = "0.1.9"
3
+ version = "0.2.0"
4
4
  description = "Yearning MySQL Audit Platform CLI Tool"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -218,7 +218,7 @@ wheels = [
218
218
 
219
219
  [[package]]
220
220
  name = "yearning-cli"
221
- version = "0.1.9"
221
+ version = "0.2.0"
222
222
  source = { editable = "." }
223
223
  dependencies = [
224
224
  { name = "msgpack" },
@@ -1,6 +1,7 @@
1
1
  """CLI entry point for yearning-cli."""
2
2
 
3
3
  import argparse
4
+ from datetime import datetime, timedelta, timezone
4
5
  import logging
5
6
  import os
6
7
  import sys
@@ -12,6 +13,17 @@ from mysql_proxy.server import serve
12
13
 
13
14
  BASE_URL = os.environ.get("YEARNING_URL", "http://192.168.1.135")
14
15
  CONFIG_FILE = os.path.expanduser("~/.sqlrc")
16
+ EAST_8 = timezone(timedelta(hours=8))
17
+
18
+
19
+ class East8Formatter(logging.Formatter):
20
+ """Format log timestamps with a fixed UTC+8 timezone."""
21
+
22
+ def formatTime(self, record: logging.LogRecord, datefmt: str | None = None) -> str:
23
+ dt = datetime.fromtimestamp(record.created, tz=EAST_8)
24
+ if datefmt:
25
+ return dt.strftime(datefmt)
26
+ return dt.strftime("%Y-%m-%d %H:%M:%S")
15
27
 
16
28
 
17
29
  def load_config() -> dict:
@@ -359,10 +371,17 @@ def cmd_shell(args: argparse.Namespace) -> None:
359
371
  def cmd_proxy(args: argparse.Namespace) -> None:
360
372
  """Start MySQL protocol proxy server."""
361
373
  level = logging.DEBUG if VERBOSE else logging.INFO
374
+ handler = logging.StreamHandler()
375
+ handler.setFormatter(
376
+ East8Formatter(
377
+ fmt="%(asctime)s [%(levelname)s] %(message)s",
378
+ datefmt="%Y-%m-%d %H:%M:%S",
379
+ )
380
+ )
362
381
  logging.basicConfig(
363
382
  level=level,
364
- format="%(asctime)s [%(levelname)s] %(message)s",
365
- datefmt="%H:%M:%S",
383
+ handlers=[handler],
384
+ force=True,
366
385
  )
367
386
  if not VERBOSE:
368
387
  logging.getLogger("websocket").setLevel(logging.WARNING)
File without changes
File without changes
File without changes
File without changes