-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to use ulog (doesn't work properly) - See Download/ulog#29
- Loading branch information
1 parent
918ab34
commit 212f254
Showing
6 changed files
with
490 additions
and
781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ulog from 'ulog'; | ||
|
||
// Formats aren't applied when doing logger.info() | ||
// See https://github.com/Download/ulog#formatting | ||
const myFormat = (logger, method, args): void => { | ||
// add the logger name to the call | ||
args.unshift(`[${logger.name}] `); | ||
}; | ||
|
||
/** | ||
* Create a new | ||
* | ||
* @param name | ||
* @param options | ||
*/ | ||
export const createLogger = (name: string, options?: object): any => { | ||
ulog.level = process.env.APP_STAGE === 'production' ? ulog.ERROR : ulog.DEBUG; | ||
ulog.formats.push(myFormat); | ||
|
||
return ulog(name); | ||
}; | ||
|
||
export default createLogger; |
Oops, something went wrong.