Simple logger which can work with network!
Project description
sherlog
Usage
Default logger
By default, logger will record everything in the directory where you calling it
from sherlogger import logger
logger.info("Service is up...")
To change logs directory call .set_streams()
method
from sherlogger import logger
from sherlogger import FileSystemHandler
logger.set_streams( # [<path_to_dirs>], <Handler>
["~/home/ubuntu/..."], FileSystemHandler
)
logger.info("THIS IS LOG MESSAGE")
Telegram logger
Setup
-
.ini file
Create plugins.ini file. Format of file and required data is located in plugins.ini.example
Logger sends your message to telegram in asynchronous manner.
telegram_logger
will send messages in separated thread.
Custom logger
- Import
get_logger
& handlers
from pathlib import Path
from sherlogger import get_logger, TelegramHandler, FileSystemHandler
ABS_PATH = Path().resolve()
logger = get_logger(__name__)
logger.basic_config(
handlers=[TelegramHandler, FileSystemHandler],
plugins_ini_path=f"{ABS_PATH}/plugins.ini",
level="INFO"
)
logger.set_streams(
["./logs/"], FileSystemHandler
)
logger.info("This is a message")
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
sherlogger-0.0.4.tar.gz
(7.7 kB
view hashes)
Built Distribution
sherlogger-0.0.4-py3-none-any.whl
(10.0 kB
view hashes)
Close
Hashes for sherlogger-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53c8c837679cb255ff5ed997b1aa97c324c72b859896a92b1f610385c3cd7dcf |
|
MD5 | 8f77f6d0b75787ec84df146fe51ae416 |
|
BLAKE2b-256 | d94764a179cd3dfd68e71339adc59b8c1b3dda971e9dae4e18a752e5438c0884 |