A simple to use logger.
npm i letslog
import { Logger } from "letslog";
const logger = new Logger();
logger.warn("first output");
import { Logger, ELoglevel, ETransportType } from "letslog";
const logger = new Logger({
baseComment: "RepositoryService",
loglvl: ELoglevel.DEBUG,
transports: [
{
showBaseComment: true,
showDate: true,
showLoglevel: true,
type: ETransportType.console
}
]
});
logger.warn("first output");
import { Logger, ELoglevel, ETransportType } from "letslog";
const logger = new Logger({
baseComment: "RepositoryService",
loglvl: ELoglevel.DEBUG,
transports: [
{
showBaseComment: true,
showDate: true,
showLoglevel: true,
type: ETransportType.console
},
{
baseComment: "index.ts",
loglvl: ELoglevel.INFO,
logpath: "%appdata%/testfolder",
logFileName: "testing",
type: ETransportType.filesystem,
showBaseComment: true,
showDate: true,
showLoglevel: true
}
]
});
logger.info("first output");
on the toplevel you can set the following properties. When using top level properties you do not need to add thes Properties in the transports. When you set a Property in the transport, it will override the top level Propertie
options | Type | Default Values | Mandatory |
---|---|---|---|
base Comment | string | none | optional |
loglvl | ELoglevel/number | WARN | optional |
transport | ITransport[] | none | optional |
options | Type | Default Values | Mandatory |
---|---|---|---|
baseComment | string | none | optional |
loglvl | ELoglevel/number | WARN | optional |
showBaseComment | boolean | false | optional |
showDate | boolean | false | optional |
showLoglevel | boolean | true | optional |
type | ETransportType/number | console | optional |
logpath | string | none | optional |
logFileName | string | log | optional |
type | value |
---|---|
TRACE | 0 |
DEBUG | 1 |
INFO | 2 |
WARN | 3 |
ERROR | 4 |
type | value |
---|---|
console | 0 |
filesystem | 1 |