Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
A simple library for logging with Python3
For a quick example, refer to the test.py on the github repository
With justlog, everything is handled within a single class: Logger
Spawn an instance of this class to start logging quickly.
from justlog import justlog, settings
logger = justlog.Logger(settings.Settings())
Instances must be initialized with a Settings
instance that can be customized before or after instantiation.
log(message)
Settings
class: logger.settings.current_log_level
debug(message)
current_log_level
to Severity.DBG
and calls the log()
functioninfo(message)
current_log_level
to Severity.INF
and calls the log()
functionwarning(message)
current_log_level
to Severity.WRN
and calls the log()
functionerror(message)
current_log_level
to Severity.ERR
and calls the log()
functionappname: str
current_log_level: Severity
DBG
INF
WRN
ERR
colorized_logs: Bool
Severity
log_format: Format
TEXT
JSON
log_output: [Output]
STDOUT
STDERR
TCP
FILE
SYSLOG
HTTP
string_format: str
TEXT
formattimestamp_format
$TIMESTAMP
variable format using stfrtime codesupdate_field(key: str, value: str)
$
symbol within the string_format
delete_field(key: str)
tcp_output_host(host: str)
tcp_output_port(port: int)
http_url(url: str)
http_headers(header: dict)
http_print_response(bool)
$TIMESTAMP
timestamp_format
setting using stfrtime codes$CURRENT_LOG_LEVEL
current_log_level
setting at the moment of the call.$message
from justlog import justlog, settings
from justlog.classes import Severity, Output, Format
logger_stdout = justlog.Logger(settings.Settings())
logger_stdout.settings.colorized_logs = True
logger_stdout.settings.log_output = [Output.STDOUT]
logger_stdout.settings.update_field("application", "sample")
logger_stdout.settings.update_field("timestamp", "$TIMESTAMP")
logger_stdout.settings.update_field("level", "$CURRENT_LOG_LEVEL")
logger_stdout.settings.string_format = "[ $timestamp ] :: Level: $CURRENT_LOG_LEVEL, application: $application :: $message"
logger_stdout.info("Information")
logger_stdout.error("Error")
logger_stdout.warning("Warning")
logger_stdout.debug("Debug")
FAQs
A simple logging library for Python 3
We found that justlog 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.