Skip to main content

k8s_logger

如何使用logger

  • logger会从环境变量中获取"logPath"与"jobName"
  • 调用print_log时,传入的文本需要以 "|" 分隔字符串

demo.py

from logger.Logger import *

# 初始化配置。只需要调用一次即可。
init_config()

print_log(
    "2019-07-19-07-30: epoch: 182 |loss 0.448047 | hm_loss 0.262451 | wh_loss 0.538236 | off_loss 0.140742 | corner_loss 0.380307 | time 3.100000 | loss 1.256430 |",
    "loss")

控制台输出

/Users/bianlifeng/anaconda3/bin/python /Users/bianlifeng/PycharmProjects/k8s_logger/test.py
logging init log_path:[/Users/bianlifeng/PycharmProjects/k8s_logger/job.log] 

Process finished with exit code 0

/Users/bianlifeng/PycharmProjects/k8s_logger/job.log

2019-07-23 17:06-INFO-2019-07-23 | loss 0.448047  |  hm_loss 0.262451  |  wh_loss 0.538236  |  off_loss 0.140742  |  corner_loss 0.380307  |  loss 1.256430 

test

使用config_log方法手动设置文件路径即可

demo.py

from logger.Logger import print_log
from logger.Config import Config

config = Config()
config.config_log("/Users/bianlifeng/PycharmProjects/k8s_logger/debug.log")

print_log(
    "2019-07-19-07-30: epoch: 182 |loss 0.448047 | hm_loss 0.262451 | wh_loss 0.538236 | off_loss 0.140742 | corner_loss 0.380307 | time 3.100000 | loss 1.256430 |",
    "loss")

控制台输出

/Users/bianlifeng/anaconda3/bin/python /Users/bianlifeng/PycharmProjects/k8s_logger/test.py
logging init log_path:[/Users/bianlifeng/PycharmProjects/k8s_logger/debug.log] 

Process finished with exit code 0

Metadata

Release files for k8s-logger 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for k8s-logger 0.0.2
File Size Uploaded Provenance
k8s_logger-0.0.2.tar.gz 3.1 kB Without provenance Details

Release files / k8s_logger-0.0.2.tar.gz

Download URL k8s_logger-0.0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ab0127ac722e95823c5df559319125fb62f52b77668676d7a0f3d1327e8f994
BLAKE2b-256 checksum
How to use checksums
9b52cb6e7fcf78d6d32461d5975ceec82eb40a39fdcc4a7d22c08d6c3536137a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

Security for k8s-logger 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page