Yet another python logger, or is it like any other?
Project description
SageLogger: Python Logger Package
SageLogger is a versatile Python logger package that allows you to create loggers with both remote and local capabilities. The core module, "SageFactory.py," facilitates the creation of loggers with options for SageRemoteLogger (remote) and SageLogger (local). When using SageLogger, you have the flexibility to choose from 7 predefined log types for local logging: DEFAULT, POSITIVE, ONHOLD, NEGATIVE, FROZEN, INFORMATION, and MILD_EXCEPTION. Additionally, you can easily create custom log types to suit your specific needs using the SageLogger.DynamicType class.
Features
Local Logging Options
SageLogger offers 7 built-in log types for local logging:
- DEFAULT: The default log type.
- POSITIVE: For positive events and actions.
- ONHOLD: To indicate events that are on hold or waiting for further action.
- NEGATIVE: For negative events or errors.
- FROZEN: To represent frozen states or events.
- INFORMATION: For general information logging.
- MILD_EXCEPTION: To log minor exceptions or errors.
Custom Local Log Types
Apart from the predefined log types, you can create custom log types using the SageLogger.DynamicType.fromChar method or the SageLogger.DynamicType.fromColoredChar method for colored logs.
Remote Logging
SageLogger enables remote logging capabilities through the SageRemoteLogger class. You can load custom APIs for remote logging, and it also provides built-in support for Discord webhook integration.
Example Code
To create a local logger with SageLogger, you can use the following code:
from SageLogger import SageFactory, Logger
import colorama
sagelogs = SageFactory.create("tester", True)
sagelogs.toggle_type(sagelogs.Type.DEBUG)
sagelogs.log("Checking all types")
for x in sagelogs.Type.__iter__():
sagelogs.log("Hello World! It's " + x.name, type=x)
sagelogs.log("It's dynamic!", type=Logger.DynamicType.fromChar(sagelogs, "XD"))
sagelogs.log("Doing the test again but with changed borders")
sagelogs.customization.set_border_style(colorama.Fore.GREEN, "()")
for x in sagelogs.Type.__iter__():
sagelogs.log("Hello World! It's " + x.name, type=x)
sagelogs.log("Disabling some types...")
sagelogs.disable_type(sagelogs.Type.__iter__()[3])
sagelogs.toggle_type(sagelogs.Type.__iter__()[5])
sagelogs.enable_type(sagelogs.Type.DEBUG)
for x in sagelogs.Type.__iter__():
sagelogs.log("Hello World! It's " + x.name + " - check with above ones! There will be some missing :(", type=x)
sagelogs.log("It's dynamic!", type=Logger.DynamicType.fromColoredChar(sagelogs, colorama.Fore.LIGHTYELLOW_EX, "X"))
sagelogs.log("I'm ID 21", type=Logger.DynamicType.fromColoredChar(sagelogs, colorama.Fore.LIGHTYELLOW_EX, "N"), id=20)
sagelogs.log("I have time", type=Logger.DynamicType.fromColoredChar(sagelogs, colorama.Fore.LIGHTYELLOW_EX, "N"), date=True)
sagelogs.log("I have date", type=Logger.DynamicType.fromColoredChar(sagelogs, colorama.Fore.LIGHTYELLOW_EX, "N"), time=True)
sagelogs.log("I have time and date", type=Logger.DynamicType.fromColoredChar(sagelogs, colorama.Fore.LIGHTYELLOW_EX, "N"), time=True, date=True)
sagelogs.log("I have time and date", type=Logger.DynamicType.fromColoredChar(sagelogs, colorama.Fore.LIGHTYELLOW_EX, "N"), time=True, date=True, timecolor=colorama.Fore.YELLOW, datecolor=colorama.Fore.RED)
sageremotelog = SageFactory.create_discord_webhook_remote("<webhook>", savetofile=True)
sagelogs.log("It's debug", type=sagelogs.Type.DEBUG)
sagelogs.log("Sent to discord", type=sagelogs.Type.INFORMATION)
sageremotelog.log("I sent to discord!")
IntelliSense should show you around!
Big issue: In logs it writes color codes.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SageLogger-1.0.tar.gz.
File metadata
- Download URL: SageLogger-1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc49c05847e876dbde332c1706c1d3b8e53706841abdbee33fce760e449f37ed
|
|
| MD5 |
03141ccf3f1d67db2e2b726a1d7365b9
|
|
| BLAKE2b-256 |
edad81fb4168a674c522bba9f160b5064f42c3c572d5a64671aa4ff0e449d36b
|
File details
Details for the file SageLogger-1.0-py3-none-any.whl.
File metadata
- Download URL: SageLogger-1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c38fd17895f0046cff13f7f4b4521f9f0761309367d6fa7c64f7eb23e266e0b
|
|
| MD5 |
3873ffdfd7c8ccfa8555d805598ee3e3
|
|
| BLAKE2b-256 |
bd69a93be8cd7592a92d3d911ebc7f3007d4eaebf7451fc010931f9de3a117f8
|