Skip to content

Java library to send log to telegram groups and users through bots

License

Notifications You must be signed in to change notification settings

LeandroLucas/tlogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TLogger

Java library to send log to telegram users and groups through bots.

How it works

TLogger sends messages to selecioned users and groups in telegram through bots. Every message contains a timestamp, the hostname where the application is running and optionals informations like description, message, class name and stacktrace.

How to use

Prerequisites

You need a bot to send logs for you. Just talk to BotFather and follow a few simple steps. You also need a chat id from a user or group. Use IDBot for that.

Using

Setup TLogger with a telegram bot token and a default chat id

TLogger.setup("BOT_TOKEN", -12314124l);

Send logs to telegram

TLogger.getLogger().send(ExampleClass.class, "Message to send", new RuntimeException("Throwable example"));

Setup tlogger.json

tlogger.json is a file to setup chat's and application description:

{
	"active": true,
	"description": "app description",
	"chats": [
		{
			"name": "group-x",
			"id": -0
		},
		{
			"name": "user-z",
			"id": 0
		}
	]
}

active: Disable/Enable the logger. if you need the logger to start on or off, this can be changed with TLogger.getLogger().disable() and TLogger.getLogger().enable()

description: A description of the application that will send logs

chats: Chat's to send logs. Chat's in tlogger.json are used by their names in the send method.

About

Java library to send log to telegram groups and users through bots

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages