Skip to main content

csmlog

Build Status

Package to setup a python logger the way I like to use it.

  • By default logs to files per logger and one for the overall project
  • Sets a master logger with sub loggers per file (obtained via getLogger())

Usage

from csmlog import setup, getLogger
setup("appName") # call setup once whenever you would like to set the output location for future loggers
logger = getLogger(__file__)

# logger is a Python logger... feel free to use it.
# You should see logs in %APPDATA% on Windows and /var/log or ~/log on Linux/Mac

Google Sheets Logging

setup() has an optional parameter: googleSheetShareEmail. If it is given, it should be an email address to share a Google Sheets worksheet of logs.

In order to use this, you must have a Google Service Account or User Account's credentials (in JSON form) in ~/.gcreds.json

Internally the gspread module is used for Google Sheets communication/authentication. See https://gspread.readthedocs.io/en/latest/oauth2.html for more information on getting credentials. The only thing different from their instructions is that for csmlog, the JSON credentials should be stored in ~/.gcreds.json.

Note that logs may be delayed due to rate limiting, etc. If you are logging a lot, it may not be a good idea to enable this feature.

Customized Child Loggers

setup() has an optional parameter: modifyChildLoggersFunc. If it is given, it must be a function that would take in as a single arg, each created child logger. This can be used to add additional things like handlers to each child logger. (Note that the child logger is modified in place).

Installation

pip install csmlog

Metadata

Release files for csmlog 0.28.0

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

Source distribution (sdist)

Source distribution for csmlog 0.28.0
File Size Uploaded
csmlog-0.28.0.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csmlog 0.28.0
File Interpreter ABI Platform
csmlog-0.28.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / csmlog-0.28.0.tar.gz

Download URL csmlog-0.28.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
21c6460dadd4eaec6eb06003db0bb9a675099acf33f78740ef69594245b5ad15
BLAKE2b-256 checksum
How to use checksums
ebd831703020eb8fe2f36d49d0ac3d2505360c5d3222f32efdbabd78804bc813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / csmlog-0.28.0-py3-none-any.whl

Download URL csmlog-0.28.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5e2ce1978e45c4044d071446d73f2d26b29ae15a7e09e82f778ac4c423149dc
BLAKE2b-256 checksum
How to use checksums
7a46ba36a833422305b2a2384713710f149870b4ca2c4ff41a79ca031644768e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2
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