Skip to main content

Logging for Stockholm University

Project description

Logging for Stockholm University

Easy to use logging for Stockholm University.

Usage

Syslog

For normal usage which logs to syslog:

from su.logging import logging

logger = logging.getLogger("myapp")
logger.warning("My WARNING message")

Console

For easier developing you can also switch to console logging:

from su.logging import console, logging

logger = logging.getLogger("myapp")
logger.warning("My WARNING message")

Structured logging

We use logstash_formatter's LogstashFormatterV1 and remove some unused/unnecesary fields.

Depend on su-logging[structured] in e.g. your requirements.txt and then:

from su.logging import logging, structured

logger = logging.getLogger("myapp")
logger.warning("User logged in", extra={"user": "simlu"})

try:
    raise Exception("User performed illegal activity")
except Exception as e:
    logger.exception(e, extra={"user": "simlu"})

Container usage

In Containers, which usually adhere to the 12 factor apps manifesto, you usually log to STDOUT and let your container engine deal with them.

from su.logging import console, logging, structured

logger = logging.getLogger("myapp")
logger.warning("My WARNING message")

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

su-logging-1.0.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

su_logging-1.0.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file su-logging-1.0.0.tar.gz.

File metadata

  • Download URL: su-logging-1.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.4.0

File hashes

Hashes for su-logging-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0675c0bf25a72caa07a585a504282f306592d3f8b090a60b3102d3e63064339d
MD5 aaf13bbd22a7b8d97d0f822eb22ddff2
BLAKE2b-256 b85ba70fe3205588b31c0e429ecb76c3a1fe85e2da56c94c1dd1b4eec93f8411

See more details on using hashes here.

File details

Details for the file su_logging-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: su_logging-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.1 Darwin/20.4.0

File hashes

Hashes for su_logging-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36cf3052efbce781049d036e50062e6c986a5c638d0a264f5addcea057f7fe6c
MD5 cc4075cdf7b9a1eb1fe89c66b14c0d46
BLAKE2b-256 284a870ccbb3fc9f27880bf2604f1d3ba64833d878cf5df0f3c0d02812a23cc1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page