Skip to content

Commit

Permalink
Use winston logger
Browse files Browse the repository at this point in the history
  • Loading branch information
francocorreasosa authored and machuga committed Nov 15, 2017
1 parent 59b591c commit cac5166
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion api/get_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { decode } from 'jsonwebtoken';
import config from '../lib/config';
import findUsersByEmail from '../lib/findUsersByEmail';
import indexTemplate from '../templates/index';
import logger from '../lib/console';
import logger from '../lib/logger';

const version = require('../package.json').version;

Expand Down
4 changes: 2 additions & 2 deletions api/hooks/delete_uninstall.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { uninstall } from '../../modifyRule';
import config from '../../lib/config';
import logger from '../../lib/console';
import logger from '../../lib/logger';

module.exports = server => ({
method: 'DELETE',
Expand All @@ -13,7 +13,7 @@ module.exports = server => ({
]
},
handler: (req, reply) => {
logger.log('Starting uninstall...');
logger.info('Starting uninstall...');

Promise.all([
uninstall(req.pre.auth0.rules),
Expand Down
6 changes: 3 additions & 3 deletions api/hooks/post_install.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { install } from '../../modifyRule';
import config from '../../lib/config';
import logger from '../../lib/console';
import logger from '../../lib/logger';

module.exports = server => ({
method: 'POST',
Expand All @@ -13,7 +13,7 @@ module.exports = server => ({
]
},
handler: (req, reply) => {
logger.log('Starting rule installation...');
logger.info('Starting rule installation...');

install(req.pre.auth0.rules, {
extensionURL: config('PUBLIC_WT_URL'),
Expand All @@ -22,7 +22,7 @@ module.exports = server => ({
})
.then(() => reply().code(204))
.then(() => {
logger.log('Rule successfully installed');
logger.info('Rule successfully installed');
})
.catch((err) => {
logger.error('Something went wrong, ', err);
Expand Down
2 changes: 1 addition & 1 deletion build/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nconf = require('nconf');
const path = require('path');
const logger = require('./lib/console').default;
const logger = require('./lib/logger');

// Load babel
require('./lib/babel')();
Expand Down
2 changes: 1 addition & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { managementApi } from 'auth0-extension-tools';
import request from 'request';
import config from './config';
import logger from '../lib/console';
import logger from '../lib/logger';

// Memoized because config unavailable at this point
const urlHelper = {
Expand Down
9 changes: 0 additions & 9 deletions lib/console.js

This file was deleted.

2 changes: 1 addition & 1 deletion server/handlers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { handlers } from 'auth0-extension-hapi-tools';
import config from '../lib/config';
import logger from '../lib/console';
import logger from '../lib/logger';

const register = (server, options, next) => {
server.decorate('server', 'handlers', {
Expand Down
2 changes: 1 addition & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Hapi from 'hapi';
import Inert from 'inert';
import jwt from 'hapi-auth-jwt2';
import config from '../lib/config';
import logger from '../lib/console';
import logger from '../lib/logger';
import routes from './routes';
import defaultHandlers from './handlers';
import auth from './auth';
Expand Down
2 changes: 1 addition & 1 deletion server/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';
import { FileStorageContext, WebtaskStorageContext } from 'auth0-extension-tools';
import config from '../lib/config';
import createServer from './index';
import logger from '../lib/console';
import logger from '../lib/logger';
import { init as initStorage } from '../lib/db';

const defaultCallback = (err) => {
Expand Down
2 changes: 1 addition & 1 deletion webtask.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tools from 'auth0-extension-hapi-tools';
import hapiApp from './server/init';
import logger from './lib/console';
import logger from './lib/logger';
import config from './lib/config';

const createServer = tools.createServer((wtConfig, wtStorage) => {
Expand Down

0 comments on commit cac5166

Please sign in to comment.