
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.
Simplifying the use of logs based on build-in logging.
format
waypip install logifire
from logifire import Logifire
log = Logifire() # init log with stderr handler by default
log.debug("Test arg='{}' and kwargs: foo='{foo}', bar='{bar}'", "first arg", foo="fval", bar="bval")
# 2022-05-27T23:27:42.721 28696 [DEBUG ] main.<module>: Test arg='first arg' and kwargs: foo='fval', bar='bval'
# shared/config.py
import logging
from logifire import Logifire, Logbranch
log = Logifire(branches=[
logging.FileHandler('main.log')
])
# some_service/config.py
import logging
from logifire import Logbranch
from logifire.handlers import SysLogifireHandler
from shared.config import log
log.set_name('some_service') # set name for logger
log.set_level(logging.INFO) # set global level
log.add( # add syslog for only warnings
Logbranch(SysLogifireHandler(), level=logging.WARNING)
)
This example sets up a Logifire (DEBUG as main level) with a Syslog handler and a Slack handler with a 5-second mute using Memcached.
This allows all DEBUG-level messages to be written to syslog and CRITICAL level messages to be sent to the Slack channel, but no more than once every 5 seconds. Since Memcached (in this case) is used as the backend for mute, it'll work across the entire cluster if the service is running on multiple servers.
import logging
from logifire import Logifire, Logbranch
from logifire.blowout import BlowoutMemcached
from logifire.handlers import SysLogifireHandler, SlackLogifireHandler
log = Logifire(
name='my_service', # your service name
level=logging.DEBUG, # main log level
branches=[
Logbranch(SysLogifireHandler()), # add Syslog handler, you can use any logging.Handler
Logbranch( # add Slack handler
handler=SlackLogifireHandler("<token>"),
level=logging.CRITICAL, # send only critical messages to Slack
blowout_seconds=5 # after sending a message, mute the sending for 5 seconds
)
],
blowout=BlowoutMemcached([('127.0.0.1', 11211)]) # use Memcached for the mute feature (pymemcache lib required)
)
log.debug("Test debug message") # send to syslog
log.info("Test info message") # send to syslog
log.critical("Test critical message") # send to syslog and slack
Copyright (C) 2022 by Dmitry Parfyonov parfyonov.dima@gmail.com
MIT License, see http://opensource.org/licenses/MIT
FAQs
Logs manager with mute log feature at different levels: process, server, cluster
We found that logifire 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.