
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Logscope is a Python logging library that brings together SQLite storage and pretty console output. Write logs to both your terminal and a queryable database with a dead-simple API.
pip install logscope
from logscope import logger
# Get a logger with default settings (SQLite + console output)
log = logger()
# Log some things!
log("Starting analysis")
log("Processing item", {"id": 123, "status": "pending"})
import logging
from logscope import logger
# All settings are optional
log = logger(
db_path='app.db', # Where to store the SQLite database
style='plain', # 'plain' or 'colorful' console output
name='MyApp', # Logger name (defaults to timestamp)
level=logging.INFO # Logging level (default: DEBUG)
)
Logscope includes a @trace
decorator to automatically log function calls, returns, and exceptions:
from logscope.tracing import trace
@trace
def my_function(a, b):
return a + b
my_function(2, 3) # Automatically logs the call, return value, and source code
Each log message is:
Example console output:
2024-03-15 14:23:45.123456> Starting analysis
· process_data:data = process_data("large_file.txt")
· /path/to/script.py:45
Use the query
function to fetch logs directly from Python:
from logscope import query
logs = query("SELECT * FROM logs WHERE event_type = 'error'", db_path='app.db')
for log in logs:
print(log)
Logs are stored in SQLite with this schema:
CREATE TABLE logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
run TEXT, -- Unique ID for each logger instance
timestamp TEXT, -- ISO format with microseconds
message TEXT, -- The logged message
filename TEXT, -- Source file path
lineno INTEGER, -- Line number
source TEXT, -- The actual calling code
function TEXT, -- Calling function name
event_type TEXT -- Custom event type (e.g., 'error', 'info')
);
Get the last 10 logs from a specific run:
SELECT timestamp, message, function
FROM logs
WHERE run = '2024-03-15 14:23:45.123456'
ORDER BY timestamp DESC
LIMIT 10;
Find all errors from a specific function:
SELECT timestamp, message
FROM logs
WHERE function = 'process_data'
AND message LIKE '%error%'
ORDER BY timestamp;
Retrieve all logs with a custom event type:
SELECT *
FROM logs
WHERE event_type = 'trace';
MIT License - See LICENSE file for details
FAQs
Fancy logging with local SQLite storage.
We found that logscope demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.