How to use console-stamp - 4 common examples

To help you get started, we’ve selected a few console-stamp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FreeFeed / freefeed-server / index.js View on Github external
/* eslint babel/semi: "error" */
import consoleStamp from 'console-stamp';

import { getSingleton as initApp } from './app/app';


consoleStamp(console, 'yyyy/mm/dd HH:MM:ss.l');

initApp()
  .catch((e) => {
    process.stderr.write(`FATAL ERROR\n`);
    process.stderr.write(`${e.message}\n`);
    process.stderr.write(`${e.stack}\n`);
    process.exit(1);
  });
github RoseRocket / express-handlebars-boilerplate / server / server.js View on Github external
import allowCORSHandler from './middlewares/allowCORS.js';
import notFoundRequest from './middlewares/notFound.js';
import logErrorsHandler from './middlewares/logErrors.js';
import errorHandler from './middlewares/serverError.js';
import * as helpers from './utils/hbsHelpers.js';

const PRODUCTION_MODE = 'production';

let { PORT = 3000 } = process.env;
const { HOST = 'localhost', TITLE, PID_FILE } = process.env;

const PING = 'ping';

const app = express();

consoleStamp(console, { pattern: 'dd/mmm/yyyy:HH:MM:ss o' });

logger.token('date', () => moment().format('DD/MMM/YYYY:HH:mm:ss ZZ'));

app.use(logger('common'));
app.use(bodyParser.json());
//Defining middleware to serve static files
app.use('/static', express.static(path.join(__dirname, '../public')));

// Use Handlebars as my main render engine
app.engine(
  'handlebars',
  exphbs({
    defaultLayout: 'main',
    helpers,
  })
);
github JaredHawkins / TweetGeoViz / server / server.js View on Github external
import notFoundRequest from './middlewares/notFound.js';
import logErrorsHandler from './middlewares/logErrors.js';
import errorHandler from './middlewares/serverError.js';
import db from './store/db.js';

let { port = 3000 } = config;

const {
  ip = 'localhost',
  apiPrefix = 'api',
  apiVersion = 'v1'
} = config;

const app = express();

consoleStamp(console, { pattern: 'dd/mmm/yyyy:HH:MM:ss o' });

logger.token('date', () => moment().format('DD/MMM/YYYY:HH:mm:ss ZZ'));

app.use(logger('common'));
app.use(bodyParser.json());

app.use('/*', allowCORSHandler);
app.use(`${apiPrefix}/*`, authRequest);
app.use([apiPrefix + apiVersion, apiPrefix], routes);
app.use(notFoundRequest);

app.use(logErrorsHandler);
app.use(errorHandler);

// connect to mongodb
db.connect();

console-stamp

Patch NodeJS console methods in order to add timestamp information by pattern

MIT
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis

Popular console-stamp functions