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

@nokya/aya

v0.1.2

Published

the best logging library in the entire worldddddd!!1

Downloads

6

Readme

✨ Features

  • 🌸 Fully Customizable: Want to change the prefix "error" to "success"? I don't know why anyone would do something this stupid, but you can if you want.....!!!!
  • 🎨 Colored: Because plain text is boring :)
  • 📝 File Support: You can write all your logs to a file (woww that's so cool and innovative)
  • 👾 Discord Webhook Support: Are you a bad developer who's always breaking things? (cof cof) You can receive a notification in Discord each time your server is exploding!! 💥💣

📩 Installation

$ npm install @nokya/aya  # Using npm
$ pnpm install @nokya/aya # Using pnpm
$ yarn add @nokya/aya     # Using yarn

👩‍💻 Basic Usage

import Logger from '@nokya/aya'
import chalk from 'chalk'

const log = new Logger({
    prefix: '(my-app)',
    levelPrefixes: {
        debug: '🐛 > debug✨🐜',
        info: '📢 > info🔊🔎',
        warn: '⚠️ > warn🚨⚡',
        error: '🚨 > error🔥💥'
    }
})

log.debug('this is a debug message')
log.info("and i'm an info message!!")
log.warn(chalk.yellow('warning!! danger ahead!!'))
log.error(chalk.red('OH NOOOOO!! something went wrong!!'))

[!TIP] You can check more examples in the examples folder.

📚 Documentation

Instantiating the Logger

import Logger from '@nokya/aya'

const log = new Logger(options)

Options

const options = {
    // Prefix displayed before the level
    prefix: '(aya)',

    // Log levels that will be displayed
    levels: ['debug', 'info', 'warn', 'error'],

    // Format of the log message (check out the placeholders section)
    logFormat: '{prefix} {level} {message}',

    // Output format (text or JSON)
    format: 'text',

    // Prefixes for each level
    levelPrefixes: {
        debug: '[🐛 debug]',
        info: '[🔍 info]',
        warn: '[☢️  warn]',
        error: '[❌ error]'
    },

    // Bold levels in output
    boldLevel: true,

    // Colors for each level prefix (uses chalk)
    colors: {
        prefix: 'blue',
        debug: 'green',
        info: 'cyan',
        warn: 'yellow',
        error: 'red'
    },

    // File logging options
    file: {
        // Enable file logging
        use: false,

        // Path to save logs
        path: './logs',

        // Maximum file size before rotating
        maxSize: '10MB',

        // File name format
        nameFormat: 'YYYY-MM-DD_HH-mm-ss',

        // Log message format for file logs (check out the placeholders section)
        logFormat: '{prefix} [{timestamp}] [{level}]: {message}'
    }
}

Placeholders

| Placeholder | Description | Example | | ------------- | ----------------------------------------------- | ----------------------- | | {prefix} | Prefix displayed before the level | (aya) | | {level} | Log message level | [🐛 debug] | | {message} | Log message content | aya is so cool!!! | | {timestamp} | Current timestamp (YYYY-MM-DD HH:mm.SSS format) | 2024-12-31 23:59:59.999 |

🎨 Formatting

You can use the chalk library to format messages or you can pass an object with the ayaMsg key to use the formatter

log.info({
    ayaMsg: 'aya is so cool!!!',
    fgColor: 'blue',
    bold: true,
    underline: true,
    italic: true
})

Oh, and we also have the y formatter if you want to use for somethign else....

import { y } from '@nokya/aya/format'

console.log(
    y({
        ayaMsg: 'aya is so cool!!!',
        fgColor: 'blue',
        bold: true,
        underline: true,
        italic: true
    })
)

Methods

log.debug(...messages: MessageType[])

Logs a debug message.

log.info(...messages: MessageType[])

Logs an info message.

log.warn(...messages: MessageType[])

Logs a warning message.

log.error(...messages: MessageType[])

Logs an error message.

log.use(plugin: LoggerPlugin)

Adds a plugin to the logger.

🔌 Plugins

👾 Discord Webhook

import { discordWebhook } from '@nokya/aya/plugins'

log.use(discordWebhook(options))

Options

const options = {
    // Webhook URL
    url: 'https://discord.com/api/webhooks/1234567890/ABCDEFGHIJKLMN',

    // Webhook username
    username: 'aya',

    // Webhook avatar (list of URLs to randomize or a single URL)
    avatarUrl: [
        'https://i.imgur.com/ukfOGMB.jpeg',
        'https://i.imgur.com/gXVlBbC.jpeg',
        'https://i.imgur.com/ZQERluU.jpeg',
        'https://i.imgur.com/BP0lfa3.jpeg'
    ],

    // Log levels to send (only 'warn' and 'error' are allowed)
    levels: ['error', 'warn'],

    // Embed labels for each level
    labels: {
        warn: ':warning: Warning',
        error: ':x: Error'
    },

    // Embed colors (hex or decimal format)
    colors: {
        warn: '#fee75c',
        error: '#ed4245'
    },

    // Display a message when the plugin is loaded
    showLoadMessage: false
}

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🌱 Contributing

Pull requests are welcome!!!!!!!!!!!! Help meeeeee!!!! 🌸🌸🌸🌸🌸