You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is very useful when [generating runtime code](#generate-runtime-module).
139
139
140
+
#### Logging
141
+
142
+
There are two "correct" ways to add console logs to your modules:
143
+
144
+
1. Use `wxt.logger` for info, warnings, and errors
145
+
2. Install [`obug`](https://www.npmjs.com/package/obug) for debug messages
146
+
147
+
```ts
148
+
import { defineWxtModule } from'wxt/modules';
149
+
import { createDebug } from'obug';
150
+
151
+
const debug =createDebug('my-module');
152
+
153
+
exportdefaultdefineWxtModule({
154
+
setup(wxt) {
155
+
wxt.logger.info('Module loaded');
156
+
debug('Debug details');
157
+
},
158
+
});
159
+
```
160
+
161
+
`wxt.logger` is great for formatted, pretty messages that match the rest of WXT's logs.
162
+
163
+
`obug` makes it easy for devs to enable and filter debug logs when necessary:
164
+
165
+
```sh
166
+
DEBUG=my-module wxt dev
167
+
```
168
+
140
169
#### Add custom entrypoint options
141
170
142
171
Modules can add custom options to entrypoints by augmenting the entrypoint options types. This allows you to add custom configuration that can be accessed during the build process.
0 commit comments