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

winston-office365-connector-hook

v0.1.7

Published

A Winston transport hook to send logs over to a Office 365 Connector, e.g. Microsoft Teams channel.

Downloads

24

Readme

winston-office365-connector-hook Build Status npm version

A Winston transport hook to send logs over to a Office 365 Connector, e.g. Microsoft Teams channel.

Inspired by winston-slack-hook by fahad19.

Uses queue implementation by jessetane for processing transport tasks.

Install

$ npm install --save winston winston-office365-connector-hook

Requirements

Note that Office 365 Connector Webhook URL is tied to a given channel, so you don't need to specify a channel name separately.

Usage

Basic

var winston = require('winston');
var Office365ConnectorHook = require('winston-office365-connector-hook');

var Logger = winston.Logger;
var Console = winston.transports.Console;

var logger = new Logger({
  transports: [
    new Console({}),
    new Office365ConnectorHook({
      hookUrl: 'https://outlook.office.com/webhook/XXXXXXXXXXXXX' // No need for a channel name
    })
  ]
});

logger.info('I am being logged here'); // will be sent to both console and Teams channel

Options

Require:

  • hookUrl: Connector Webhook URL to post to

Optional:

  • prependLevel: set to true by default, sets [level] at the beginning of the message
  • appendMeta: set to true by default, sets stringified meta at the end of the message
  • formatter(options): function for transforming the message before posting to Slack
  • colors: use this to set custom colors to log levels. Note that you MUST use hex format, not names. e.g.
  "colors": {
     "debug": "4256f4",
     "error": "f00"
   }

Behind the scenes, the level color is sent as the themeColor property of the card.

Markdown support in messages

Channel messages support Markdown syntax. Any formatting is sent as-is to the Channel.

logger.info('# Seriously!?\n > This is cool!', { title: 'You can use Markdown in messages.' });

Setting card title

You can set a title for the card by sending it as a part of the meta hash:

logger.info('This text appears in card body.', { title: 'My puny title' });

Formatter

Messages can be formatted further before posting to the channel:

var logger = new Logger({
  transports: [
    new Office365ConnectorHook({
      hookUrl: 'https://outlook.office.com/webhook/XXXXXXXXXXXXX'

      formatter: function (options) {
        var message = options.message; // original message

        // var level = options.level;
        // var meta = options.meta;

        // do something with the message

        return message;
      }
    })
  ]
});

Roadmap

See here