Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit e24bd2d

Browse files
author
Michal Vlasák
committed
🐛Fix cosmas factory type
Resolves #51
1 parent 21ff5bf commit e24bd2d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface CosmasSentry extends Cosmas {
4747
export * from './sentry';
4848

4949
export interface CosmasFactory extends Cosmas {
50-
(data?: string | CosmasOptions): Cosmas;
50+
(data?: string | CosmasOptions, loggerOptions?: CosmasOptions): Cosmas;
5151
}
5252

5353
// cannot use Symbols, because they aren't JSON.stringifyable

src/tests/index.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ test('can create logger with options', () => {
2222
expect(logger.options.pretty).toBe(true);
2323
});
2424

25+
test('can create logger with name and options', () => {
26+
const logger = loggerFactory('baseLogger', { pretty: true });
27+
expect(logger).toBeDefined();
28+
expect((logger.options as any).loggerName).toBe('baseLogger');
29+
expect(logger.options.pretty).toBe(true);
30+
});
31+
2532
test('can use custom stream', () =>
2633
new Promise((resolve, reject) => {
2734
const logger = loggerFactory({

0 commit comments

Comments
 (0)