Skip to main content

scratch-pad-py

Projects that have been ported below.

https://github.com/polonaiz/scratch-pad

mind blowing python toolset. why not pr?

Spec

Loggers: composite, console, file, fluent, jandi, line, memory, null, scribe, telegram, slack

Logger interface

from .logger_interface import LoggerInterface

class Logger(LoggerInterface):
    logger: LoggerInterface = None

    @classmethod
    def setLogger(cls, logger: LoggerInterface):
        cls.logger = logger

    @classmethod
    def getLogger(cls) -> LoggerInterface:
        return cls.logger

    @classmethod
    def info(cls, message: dict, option: dict = {}):
        cls.logger.info(message, option)

    @classmethod
    def notice(cls, message: dict, option: dict = {}):
        cls.logger.notice(message, option)

    @classmethod
    def warning(cls, message: dict, option: dict = {}):
        cls.logger.warning(message, option)

    @classmethod
    def error(cls, message: dict, option: dict = {}):
        cls.logger.error(message, option)

    @classmethod
    def critical(cls, message: dict, option: dict = {}):
        cls.logger.critical(message, option)

Usage

FileLogger

filePath = "/tmp/scratch-pad-python.log"
logger = FileLogger(
    config={
        "filePath": filePath,
        "truncate": True
    }
)
message = {
    "type": "file",
    "message": "hello world"
}
logger.info(message)

CompositeLogger

consoleLogger = ConsoleLogger(
        config={
        "appendNewLine": 1
    }
)
memoryLogger = MemoryLogger()
memoryLoggerCompositeFilter = CompositeLogger.getSelectorLevel(["info", "error"])

message = {
    "type": "composite",
    "message": "hello world"
}

compositLogger = CompositeLogger(
    config={
        "defaults": {
            "datetime": lambda: datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
            "program": "scratch-pad-python",
        },
        "loggerFilterPairs": [
            {
                "logger": consoleLogger,
                "filter": None
            },
            {
                "logger": memoryLogger,
                "filter": memoryLoggerCompositeFilter
            }
        ],
    }
)

compositLogger.info(message)

JandiLogger

url = "url"
logger = JandiLogger(
    url=url
)

message = {
    "type": "jandi",
    "message": "hello world"
}

logger.info(message)

TelegramLogger

token = "telegram"
chat_id = 1234

message = {
    "type": "telegram",
    "message": "hello world",
}

logger = TelegramLogger(
    chat_id=chat_id,
    token=token,
)

logger.info(message)

FluentLogger

logger = FluentLogger()
message = {
        "type": "fluent",
        "message": "hello world"
    }

logger.info(message)

SlackLogger

url = "url"
logger = SlackLogger(url=url)
message = {
    "type": "slack",
    "message": "hello world"
}

logger.info(message)

stuff)

scribe-docker for ScribeLogger : https://hub.docker.com/r/polonaiz/facebook-scribe

fluent-docker for FluentLogger : https://github.com/chirichidi/fluent-docker/tree/main

Metadata

Release files for scratchpad-py 0.0.7

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

Source distribution (sdist)

Source distribution for scratchpad-py 0.0.7
File Size Uploaded Provenance Actions
scratchpad_py-0.0.7.tar.gz 7.0 kB Without provenance Details for scratchpad_py-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scratchpad-py 0.0.7
File Interpreter ABI Platform Actions
scratchpad_py-0.0.7-py3-none-any.whl Python 3 none any Details for scratchpad_py-0.0.7-py3-none-any.whl

Total release size: 17.6 kB

Release files / scratchpad_py-0.0.7.tar.gz

Download URL scratchpad_py-0.0.7.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4ae4bdd9b880309dbecca47164256fad28590f3d8b010922702bf8397375da34
BLAKE2b-256 checksum
How to use checksums
a751191cc8f606ea292cf2eabe2c6263b8597dd6b8f4043aa7392887b253f942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.12

Release files / scratchpad_py-0.0.7-py3-none-any.whl

Download URL scratchpad_py-0.0.7-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42acffa51c0d96ce51f191cedb2e818b711bf364f9423409c9cf81ec04276119
BLAKE2b-256 checksum
How to use checksums
2584a113fa47a2e5ced2329360d98cb696655016b3163de4615dcb89f5393630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.12

Security for scratchpad-py 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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