Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

telogger

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telogger

Log information to Telegram.

  • 1.0.2
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
0
Weekly downloads
 
Created
Source

Telogger

Telogger can help you log information to Telegram.

Installation

npm i telogger

Usage

const { Telogger } = require('telogger')
// import { Telogger } from 'telogger'

Basic Setup

const telogger = new Telogger('AppTitle', 'BotToken', 'ID')

telogger.dump([ ], { }, 'string', 1234567890)
telogger.trace('started testing telogger')
telogger.debug('third telogger message')
telogger.info('*Telogger* supports _markdown_.')
telogger.warn('*Four* messages sent __in a row__.')
telogger.error('Unfortunately, errors are inevitable.')
telogger.fatal('Something really bad happened. Goodbye!')

Advanced Setups

You can assign different channels for different types of logs.

const telogger = new Telogger('AppTitle', 'BotToken', {
  dev: 'DevChannelID',  // for `dump`, `trace`, and `debug`
  log: { id: 'LogChannelID', silent: true },  // for `info`
  err: 'ErrChannelID'   // for `warn`, `error`, and `fatal`
})

You can also create your own channels and log levels.

const telogger = new Telogger('AppTitle', 'BotToken', {
  mychannel: {
    id: 'MyChannelID',
    silent: false,
    sendInProduction: true
  }
}, {
  dump: { to: 'MyID' },
  info: { to: 'MyID' },
  warn: { to: 'MyID' },
  myloglevel: {
    to: 'mychannel',
    icon: '🍑',
    head: '{{text}}',
    body: [ '{{rich}}', '{{location}}' ]
  }
})

telogger.send('myloglevel', 'Head Text', 'Body Rich Text')

Below is a list of the defined methods for your log levels.

telogger.silly()
telogger.test()
telogger.laconic()
telogger.verbose()
telogger.database()
telogger.security()
telogger.network()
telogger.performance()
telogger.request()
telogger.response()
telogger.success()
telogger.failure()
telogger.notice()
telogger.warning()
telogger.alert()
telogger.crit()
telogger.critical()
telogger.emerg()
telogger.emergency()

Docs

Constructor

At least one of parameters 3 and 4 must not be null.

TypeValueRequired
1String|NullApp titleOptional
2StringBot tokenYes
3Number|String|Object|NullID, username, or channelsOptional
4Number|String|Object|NullID, username, alias, or destinationsOptional
Channels
KeyTypeValue
[ Alias ]Number|String|ObjectID, username, or channel
Channel
KeyTypeValue
idNumber|StringID or username
silentBooleansend logs silently
sendInProductionBooleansend logs in production mode
Destinations
KeyTypeValue
[ Log Level ]StringID, username, alias, or destination
Destination
KeyTypeValue
toNumber|StringID, username, or alias
iconString|FalseFalse to disable icon
headTemplate|Array|FalseFalse to disable head
bodyTemplate|Array|FalseFalse to disable body
silentBooleansend logs silently
sendInProductionBooleansend logs in production mode

Templates

Use {{keyword}} in your templates to format messages. Below is a list of supported keywords.

KeywordInputOutput
boldboldbold
italicitalicitalic
underlineunderlineunderline
strikethroughstrikethroughstrikethrough
spoilerspoiler
spoilerspoiler
blockquoteblockquote> blockquote
blockquote(1)expandable blockquote> expandable blockquote
codecodecode
preprepre
texttexttext
rich*_text_*text
json[ 'text' ][ "text" ]
json(0)[ 'text' ]["text"]
location/src/file.js:8:16
location(0)/src/file.js:8:16
location(1-2)/src/file.js:4:4 /src/file.js:3:3
location(3+)/src/file.js:2:2 /src/file.js:1:1

You can combine several keywords in your templates, for example: {{code > location}}.

Contributing

Contributions are only allowed in TON:

UQCYqT9-ycmXE3o57Cac1sM5ntIKdjqIwP3kzWmiZik0VU_b

Keywords

FAQs

Package last updated on 15 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc