
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
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
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.