Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Log78 is a flexible Python logging library that supports console, file, and server logging.
Install Log78 using pip:
pip install log78
Log78 provides two ways to log messages: a simple method for quick logging and a more detailed method using LogEntry
objects. Here's how to get started with the simple method:
from log78 import Log78
# Get the Log78 instance - no setup required!
log = Logger78.instance()
# Log a simple message
await log.INFO("Hello, Log78!")
# Log with a summary and custom level
await log.WARN("This is a warning", "Warning Summary", 60)
For more detailed logging, you can use the LogEntry
object:
from log78 import LogEntry, BasicInfo
log_entry = LogEntry(basic=BasicInfo(message="Detailed log message", summary="Log Summary"))
await log.INFO(log_entry)
Both methods are ready to use out of the box with default console and file logging.
If you need custom logging behavior, you can use the setup
method:
from log78 import Logger78. ServerLog78, FileLog78, ConsoleLog78
# Create custom logger instances if needed
server_logger = ServerLog78()
file_logger = FileLog78("custom_logfile")
console_logger = ConsoleLog78()
# Setup custom loggers
log = Logger78.instance()
log.setup(server_logger, file_logger, console_logger)
debug_kind
: A set of log debugging keywords used to control which types of logs are recorded.level_file
, level_console
, level_api
: Respectively represent the threshold levels for file logs, console logs, and API logs.debug_entry
: Used to set more fine-grained debugging conditions.from log78 import Logger78. LogEntry, BasicInfo
log = Logger78.instance()
# Adjust console log level to 0 to print all logs (for debugging)
log.level_console = 0
# Adjust file log level to 60 to only record more severe warnings and errors
log.level_file = 60
# Using different levels to record logs
log_entry = LogEntry(basic=BasicInfo(message="Debug information"))
await log.DEBUG(log_entry) # Will only output to console
log_entry.basic.message = "General information"
await log.INFO(log_entry) # Will output to console, not recorded in file
log_entry.basic.message = "Warning"
await log.WARN(log_entry) # Will be recorded in both console and file
log_entry.basic.message = "Error"
await log.ERROR(log_entry) # Will be recorded in console, file, and API
DEBUG
, INFO
, WARN
, ERROR
: Record logs of different levels.ERROR(Exception, LogEntry)
: Records exception error logs.The LogEntry
class provides structured information for detailed logging:
from log78 import Logger78. LogEntry, BasicInfo, EventInfo, HttpInfo
log_entry = LogEntry()
log_entry.basic = BasicInfo(
summary="User login successful",
log_level_number=30,
log_level="INFO",
message="User johndoe successfully logged into the system",
service_name="AuthService",
user_id="user123",
user_name="johndoe"
)
log_entry.event = EventInfo(
event_category="authentication",
event_action="login",
event_outcome="success"
)
log_entry.http = HttpInfo(
http_request_method="POST",
http_request_body_content="{\"username\":\"johndoe\",\"password\":\"*****\"}",
http_response_status_code=200,
url_original="https://api.example.com/login"
)
# Add custom properties
log_entry.add_property("customField", "customValue")
await log.INFO(log_entry)
For more detailed information, please refer to the project's GitHub repository or the API documentation.
FAQs
A flexible Python logging library supporting console, file, and server logging.
We found that log78 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.