The cutest little logger you've ever seen.
Project description
Aren't logs just a bunch of woodchips?
Woodchips was created to be the cutest little logger you've ever seen. I wanted something dead simple and reusable as I found myself using the same logging setup over and over in projects. Woodchips gives you everything you need to setup the Python logging library in your project, all without the need to import or call on the logging package, know the various syntaxes for setting up handlers and formatters, etc which makes logging with Woodchips incredibly simple and clean.
Install
# Install tool
pip3 install woodchips
# Install locally
just install
Usage
- A
Loggerinstance must be created to use Woodchips. Simply specify a name and logging level, tell Woodchips where to log items (console and/or files), and start chipping away! - Need multiple loggers, no problem. Spin up separate
Loggerinstances for your needs. Maybe you need a console logger for certain output that requires a specific format while another module needs a generic file formatter. Woodchips makes it easy to setup and configure all your loggers. - Logging to a file: Woodchips will automatically roll over your log files once it reaches the
log_size. You can configurenum_of_logsto specify how many log files will be kept in the rotation.- NOTE: Woodchips has a very small default log size of just
200kbwith5log files for a total of1mbof logs. For production applications, these values may need to be drastically increased.
- NOTE: Woodchips has a very small default log size of just
- Formatters: You can configure the format of log files per handler (console and/or files); however, defaults are set (and shown below) if you just need basic logging.
Setting up Woodchips
import woodchips
# Setup a new logger instance
logger = woodchips.Logger(
name='my_logger_name', # The name of your logger instance, often will be `__name__`
level='INFO', # The log level you want to use
)
# Setup console logging
logger.log_to_console(formatter='%(message)s')
# Setup file logging
logger.log_to_file(
location='path/to/log_files',
formatter='%(asctime)s - %(module)s.%(funcName)s - %(levelname)s - %(message)s',
log_size=200000, # Size of a single file in bytes
num_of_logs=5, # Number of log files to keep in the rotation
)
Using Woodchips
import woodchips
# Retrieve a logger instance by name (assumes it's already been created)
logger = woodchips.get('my_logger_name')
# Log a message (will be logged to console and a file based on the example from above)
logger.info('This is how to setup Woodchips!')
Logger Levels
- CRITICAL
- ERROR
- WARNING
- INFO
- DEBUG
- NOTSET
Development
# Get a comprehensive list of development tools
just --list
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file woodchips-2.0.0.tar.gz.
File metadata
- Download URL: woodchips-2.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae04ae2ebfe765c360d87187368f5cab3615dc9e79a597569ed86d2c4fa66b80
|
|
| MD5 |
882133dfc811e8925773ad76f2809fcf
|
|
| BLAKE2b-256 |
bc7a2157f115188405821e32b14baae4a8a191ca6cb4ba0f5997fa9e5953b0dd
|
File details
Details for the file woodchips-2.0.0-py3-none-any.whl.
File metadata
- Download URL: woodchips-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6438edff09192ac8a3311d4fb9cc28b1830bd875d5d39675c7a7803f24aa5d7
|
|
| MD5 |
aa1bef602f8db911fbcfd9ed91f23380
|
|
| BLAKE2b-256 |
6d5a0588e7cd36da080371a644bbe60e9bcee5e4114dfe39799642dfb5331551
|