npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

telogger

v1.0.2

Published

Log information to Telegram.

Downloads

248

Readme

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.

| № | Type | Value | Required | | --- | --- | --- | --- | | 1 | String\|Null | App title | Optional | | 2 | String | Bot token | Yes | | 3 | Number\|String\|Object\|Null | ID, username, or channels | Optional | | 4 | Number\|String\|Object\|Null | ID, username, alias, or destinations | Optional |

Channels

| Key | Type | Value | | --- | --- | --- | | [ Alias ] | Number\|String\|Object | ID, username, or channel |

Channel

| Key | Type | Value | | --- | --- | --- | | id | Number\|String | ID or username | | silent | Boolean | send logs silently | | sendInProduction | Boolean | send logs in production mode |

Destinations

| Key | Type | Value | | --- | --- | --- | | [ Log Level ] | String | ID, username, alias, or destination |

Destination

| Key | Type | Value | | --- | --- | --- | | to | Number\|String | ID, username, or alias | | icon | String\|False | False to disable icon | | head | Template\|Array\|False | False to disable head | | body | Template\|Array\|False | False to disable body | | silent | Boolean | send logs silently | | sendInProduction | Boolean | send logs in production mode |

Templates

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

| Keyword | Input | Output | | --- | --- | --- | | bold | bold | bold | | italic | italic | italic | | underline | underline | underline | | strikethrough | strikethrough | ~~strikethrough~~ | | spoiler | spoiler | spoilerspoiler | | blockquote | blockquote | > blockquote | | blockquote(1) | expandable blockquote | > expandable blockquote | | code | code | code | | pre | pre | pre | | text | text | text | | 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