Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Python log handler that posts to a Slack channel. Posts to the Slack API using Python Slack SDK.
Related Repos:
pip install logging_slacker
webhook_url
Generate a key at https://api.slack.com/webhook_url
webhook_url
True
)False
)True
)webhook_url
)webhook_url
)webhook_url
)1300
)700
)False
)
Defaults to False
. If your API key is invalid or for some other reason
the API call returns an error, this option will silently ignore the API
error. If you enable this setting, make sure you have another log
handler that will also handle the same log events, or they may be lost
entirely.This is how you use log_to_slack as a regular Python logging handler. This example will send a error message to a slack channel.
import logging
import os
from log_to_slack import SlackLogHandler
from log_to_slack.formatters import NoStacktraceFormatter, DefaultFormatter
WEBHOOK_URL = os.getenv("WEBHOOK_URL")
logger = logging.getLogger("debug_application")
logger.setLevel(logging.DEBUG)
default_formatter = DefaultFormatter("%(levelprefix)s %(asctime)s (%(name)s) %(message)s")
no_stacktrace_formatter = NoStacktraceFormatter("%(levelprefix)s %(asctime)s (%(name)s) %(message)s")
default_handler = logging.StreamHandler()
default_handler.setFormatter(default_formatter)
logger.addHandler(default_handler)
slack_handler = SlackLogHandler(webhook_url=WEBHOOK_URL, stack_trace=True)
slack_handler.setFormatter(no_stacktrace_formatter)
slack_handler.setLevel(logging.ERROR)
logger.addHandler(slack_handler)
# Main code
logger.debug("Test DEBUG")
logger.info("Test INFO")
logger.warning("Test WARNING")
logger.error("Test ERROR")
logger.fatal("Test FATAL")
logger.critical("Test CRITICAL")
try:
raise Exception("Test exception")
except Exception as e:
logger.exception(e)
This example use a subclass that will send a formatted message to a Slack channel. Learn More
class CustomLogHandler(SlackLogHandler):
def build_msg(self, record):
message = "> New message :\n" + record.getMessage()
return message
Apache 2.0
See also: https://api.slack.com/terms-of-service
FAQs
Posts log events to Slack via API
We found that logging-slacker 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.