@aircall/logger
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -6,2 +6,3 @@ import { Action } from 'redux'; | ||
LOG = "LOGGER_LOG", | ||
DEBUG = "LOGGER_DEBUG", | ||
INFO = "LOGGER_INFO", | ||
@@ -26,2 +27,3 @@ WARN = "LOGGER_WARN", | ||
}; | ||
export declare const debug: (message: string, properties?: object) => LoggerLogAction; | ||
export declare const info: (message: string, properties?: object) => LoggerLogAction; | ||
@@ -28,0 +30,0 @@ export declare const warn: (message: string, properties?: object) => LoggerLogAction; |
@@ -7,2 +7,3 @@ "use strict"; | ||
LOGGER["LOG"] = "LOGGER_LOG"; | ||
LOGGER["DEBUG"] = "LOGGER_DEBUG"; | ||
LOGGER["INFO"] = "LOGGER_INFO"; | ||
@@ -24,2 +25,7 @@ LOGGER["WARN"] = "LOGGER_WARN"; | ||
}); | ||
exports.debug = (message, properties = {}) => ({ | ||
type: LOGGER.DEBUG, | ||
message, | ||
properties | ||
}); | ||
exports.info = (message, properties = {}) => ({ | ||
@@ -26,0 +32,0 @@ type: LOGGER.INFO, |
{ | ||
"name": "@aircall/logger", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "dist/index.js", | ||
@@ -13,3 +13,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "1f4fa00ec385102fe13378472846f40e93e3bcd8", | ||
"gitHead": "9c9eb102ecd02f58e395110d86d0439cf1b4f31c", | ||
"devDependencies": { | ||
@@ -16,0 +16,0 @@ "@types/segment-analytics": "^0.0.31" |
@@ -1,4 +0,5 @@ | ||
import { isLoggerAction, LOGGER } from './actions'; | ||
import { isLoggerAction, LOGGER, log, debug, info, warn, error, track } from './actions'; | ||
import { LOGGER_LEVEL } from './Logger'; | ||
describe('action', (): void => { | ||
describe('actions', (): void => { | ||
@@ -16,2 +17,16 @@ describe('isLoggerAction', (): void => { | ||
}); | ||
describe('log, debug, info, warn, error, track', (): void => { | ||
const message = 'FOO'; | ||
const properties: object = {}; | ||
it('should have the right types', (): void => { | ||
expect(log(LOGGER_LEVEL.INFO, message, properties).type).toEqual(LOGGER.LOG); | ||
expect(debug(message, properties).type).toEqual(LOGGER.DEBUG); | ||
expect(info(message, properties).type).toEqual(LOGGER.INFO); | ||
expect(warn(message, properties).type).toEqual(LOGGER.WARN); | ||
expect(error(message, properties).type).toEqual(LOGGER.ERROR); | ||
expect(track(message, properties).type).toEqual(LOGGER.TRACK); | ||
}); | ||
}); | ||
}); |
@@ -7,2 +7,3 @@ import { Action } from 'redux'; | ||
LOG = 'LOGGER_LOG', | ||
DEBUG = 'LOGGER_DEBUG', | ||
INFO = 'LOGGER_INFO', | ||
@@ -35,2 +36,8 @@ WARN = 'LOGGER_WARN', | ||
export const debug = (message: string, properties: object = {}): LoggerLogAction => ({ | ||
type: LOGGER.DEBUG, | ||
message, | ||
properties | ||
}); | ||
export const info = (message: string, properties: object = {}): LoggerLogAction => ({ | ||
@@ -37,0 +44,0 @@ type: LOGGER.INFO, |
Sorry, the diff of this file is not supported yet
40594
649