Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Nice Log ########
.. image:: https://circleci.com/gh/rshk/nicelog.svg?&style=shield :target: https://circleci.com/gh/rshk/nicelog :alt: CircleCI build status
Provide formatters to nicely display colorful logging output on the console.
Fork this project on GitHub <https://github.com/rshk/nicelog>
_
Right now, it contains only one formatter, coloring log lines depending on the log level and adding nice line prefixes containing logger name, but future plans are to add more formatters and allow better ways to customize them.
::
pip install nicelog
Since version 0.3
, nicelog comes with a helper function to quickly
set up logging for basic needs.
.. code-block:: python
from nicelog import setup_logging
setup_logging()
Or, if you want to include debug messages too:
.. code-block:: python
setup_logging(debug=True)
.. code-block:: python
import logging
import sys
from nicelog.formatters import Colorful
# Setup a logger
logger = logging.getLogger('foo')
logger.setLevel(logging.DEBUG)
# Setup a handler, writing colorful output
# to the console
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(Colorful())
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)
# Now log some messages..
logger.debug('Debug message')
logger.info('Info message')
logger.warning('Warning message')
logger.error('Error message')
logger.critical('Critical message')
try:
raise ValueError('This is an exception')
except:
logger.exception("An error occurred")
Here it is, in all its glory:
.. image:: .screenshots/nicelog-150408.png :alt: Screenshot
The output format can be further customized, eg. if you want to reduce colorfulness or verbosity.
I usually put something like this in my (local) settings:
.. code-block:: python
LOGGING['formatters']['standard'] = {
'()': 'nicelog.formatters.Colorful',
'show_date': True,
'show_function': True,
'show_filename': True,
'message_inline': False,
}
strftime(3)
conversion specifiers %F
and %T
aren't available on all platforms: replaced with long versions
%Y-%m-%d
and %H:%M:%S
.TERM
environment variable is not set (PR #1)message_inline
argument. If set to False
,
messages will be displayed on their own line (useful when enabling a lot of
information)Added support for showing more information:
FAQs
Nice colorful formatters for Python logging.
We found that nicelog 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.