Skip to content

Commit

Permalink
added logger support as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
NB10328 authored and NB10328 committed Jan 4, 2021
1 parent 1b52712 commit adf4085
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swgoh-api-swgohgg",
"version": "0.0.7",
"version": "0.2.0",
"description": "SWGoH helper API for swgoh.gg",
"main": "index.js",
"keywords": [
Expand Down
16 changes: 11 additions & 5 deletions swgohgg-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,20 @@ class SwgohGGApi {
* Class constructor.
* @param {string} user The authentication user.
* @param {string} password The authentication password.
* @param {object} logger Log4js logger (optional).
*/
constructor (user, password) {
const log4js = require("log4js");
constructor (user, password, logger) {
// setup logging
if (logger) {
this.logger = logger;
} else {
const log4js = require("log4js");

const loggerConfig = require('./log4jsconf.json');
log4js.configure(loggerConfig);
const loggerConfig = require('./log4jsconf.json');
log4js.configure(loggerConfig);

this.logger = log4js.getLogger();
this.logger = log4js.getLogger();
}

this.urlBase = 'https://swgoh.gg';
this.token = SwgohGGApi.getToken(user, password);
Expand Down

0 comments on commit adf4085

Please sign in to comment.