Skip to content

Commit 3a8f662

Browse files
author
pooya parsa
committedApr 12, 2019
feat: expose constructor and reporters
1 parent 6cdc87a commit 3a8f662

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed
 

‎src/browser.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ import Consola from './consola.js'
22
import BrowserReporter from './reporters/browser.js'
33

44
function createConsola () {
5-
return new Consola({
5+
const consola = new Consola({
66
reporters: [
77
new BrowserReporter()
88
]
99
})
10+
11+
// Expose constructors
12+
consola.Consola = Consola
13+
consola.BrowserReporter = BrowserReporter
14+
15+
return consola
1016
}
1117

1218
export default (typeof window !== 'undefined' && window.consola) || createConsola()

‎src/node.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import env from 'std-env'
2-
import { Consola, BasicReporter, FancyReporter } from '.'
2+
import { Consola, BasicReporter, FancyReporter, JSONReporter, WinstonReporter } from '.'
33

44
function createConsola () {
55
// Log level
@@ -9,14 +9,23 @@ function createConsola () {
99
}
1010

1111
// Create new consola instance
12-
return new Consola({
12+
const consola = new Consola({
1313
level,
1414
reporters: [
1515
(env.ci || env.test)
1616
? new BasicReporter()
1717
: new FancyReporter()
1818
]
1919
})
20+
21+
// Expose constructors
22+
consola.Consola = Consola
23+
consola.BasicReporter = BasicReporter
24+
consola.FancyReporter = FancyReporter
25+
consola.JSONReporter = JSONReporter
26+
consola.WinstonReporter = WinstonReporter
27+
28+
return consola
2029
}
2130

2231
if (!global.consola) {

0 commit comments

Comments
 (0)
Please sign in to comment.