Skip to main content

Log78

Log78 is a flexible Python logging library that supports console, file, and server logging.

Installation

Install Log78 using pip:

pip install log78

Quick Start

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.

Advanced Configuration (Optional)

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)

Properties

  • 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.

Suggested Log Levels

  • DEBUG (10): Detailed debug information, typically used only in development environments
  • INFO (30): General information, can be used to track normal application operations
  • WARN (50): Warning information, indicating potential issues but not affecting main functionality
  • ERROR (60): Errors and serious problems that require immediate attention

Example: Adjusting Log Levels

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

Methods

  • DEBUG, INFO, WARN, ERROR: Record logs of different levels.
  • ERROR(Exception, LogEntry): Records exception error logs.

Using the LogEntry Class

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)

Other

For more detailed information, please refer to the project's GitHub repository or the API documentation.

Metadata

Release files for log78 2.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for log78 2.1.4
File Size Uploaded
log78-2.1.4.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for log78 2.1.4
File Interpreter ABI Platform
log78-2.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 35.0 kB

Release files / log78-2.1.4.tar.gz

Download URL log78-2.1.4.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
58d203baf0fb57f97f601857f056b6336bba10f1f066f256298045ee6f0035b8
BLAKE2b-256 checksum
How to use checksums
0e3594d81d7868f7bb7a0074bf73d5c61a9a832fd523ccf671da977fbc500b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / log78-2.1.4-py3-none-any.whl

Download URL log78-2.1.4-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30e9de9c1fc8fe5906c38ca054aeb936ed1879ccef3805817f7c1a063321d805
BLAKE2b-256 checksum
How to use checksums
5a17fc4e400faca8519fc58cd235b6bf06fb6e71e971e3c8d8cdd222a7af736f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Release history Release notifications | RSS feed

This release

2.1.4 This release

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.0.20

2 release files

2.0.19

2 release files

2.0.18

2 release files

2.0.17

2 release files

2.0.16

2 release files

2.0.15

2 release files

2.0.14

2 release files

2.0.13

2 release files

2.0.12

2 release files

2.0.11

2 release files

2.0.10

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

1.0.1

2 release files

0.1.11

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page