Skip to main content

Generic python logging library.

Documentation: https://github.com/devstuff-io/spylogger

Installation

basic loggers

This installs spylogger only and will load the loggers with no external dependency requirements.

pip install spylogger

pretty loggers

This installs spylogger, pygments, and pygments-json and loads the basic loggers along with pretty loggers.

pip install spylogger[pretty]

Configuration

Environment Variables

Name

Description

Default

SPY_LOG_LOGGER

The configured logger name. Available loggers:

  • json-flat (Default)

  • json

  • json-clean

  • json-src-key

  • pretty

  • pretty-no-meta

  • ugly

json-flat

SPY_LOG_LEVEL

The python log level. See the docs

WARNING

SPY_SHOW_META

Flag for showing the __meta output.

True

SPY_JSON_LOG_KEYS

A list of log record keys to put in the __meta section of the log message.

Available Keys:

  • args

  • created

  • exc_info

  • exc_text

  • filename

  • funcName

  • levelname

  • levelno

  • lineno

  • module

  • msecs

  • msg

  • name

  • pathname

  • process

  • processName

  • relativeCreated

  • thread

  • threadName

See the python docs

  • args

  • funcName

  • levelname

  • lineno

  • module

  • pathname

  • process

  • threadName

Pretty Formatter Styles

See the pygments documentation

Environment Variables

Name

Default

SPY_LOG_FORMATTER_DEBUG

autumn

SPY_LOG_FORMATTER_INFO

monokai

SPY_LOG_FORMATTER_WARNING

fruity

SPY_LOG_FORMATTER_ERROR

default

SPY_LOG_FORMATTER_CRITICAL

vs

Available styles

python -c "from pygments.styles import get_all_styles;print list(get_all_styles())"

Usage

from spylogger import get_logger

# get_logger(name=SPY_LOG_LOGGER, log_level=SPY_LOG_LEVEL)
logger = get_logger()

logger.info({'string': 'test Pretty info message.', 'int': 42, 'bool': True})

More examples are in example.py

Authors

See contributors section on GitHub.

Release files for spylogger 1.2.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 spylogger 1.2.2
File Size Uploaded
spylogger-1.2.2.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spylogger 1.2.2
File Interpreter ABI Platform
spylogger-1.2.2-py2-none-any.whl Python 2 none any Details

Total release size: 12.5 kB

Release files / spylogger-1.2.2.tar.gz

Download URL spylogger-1.2.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e270b7ac75008a08d036c5896e7f6a003e84e658537351d895955edc897b8513
BLAKE2b-256 checksum
How to use checksums
0b643206bcbf48e12ddecfd3bf2bc6760bc6993669cca3377d286cafe1644a1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / spylogger-1.2.2-py2-none-any.whl

Download URL spylogger-1.2.2-py2-none-any.whl
Size 7.7 kB
Tags Python 2
SHA-256 checksum
How to use checksums
a7d0876f8508d2f0264af31414176aa4c7e69f84479dde8a9d1c824ebb05ad6a
BLAKE2b-256 checksum
How to use checksums
e4abbfb04c9b09c6ced97734048baa273bf9eec706be70152c201dbada539926
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

0.0.2

1 release file

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