Skip to content

Commit 755736e

Browse files
committed
feat: add puter.log
1 parent e71fe11 commit 755736e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/puter-js/src/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,24 @@ window.puter = (function() {
150150
this.APIOrigin = 'https://api.' + URLParams.get('puter.domain');
151151
}
152152

153+
// === START :: Logger ===
154+
155+
// logger will log to console
156+
let logger = new putility.libs.log.ConsoleLogger();
157+
158+
// logs can be toggled based on categories
159+
logger = new putility.libs.log.CategorizedToggleLogger(
160+
{ delegate: logger });
161+
const cat_logger = logger;
162+
163+
// create facade for easy logging
164+
this.log = new putility.libs.log.LoggerFacade({
165+
impl: logger,
166+
cat: cat_logger,
167+
});
168+
169+
// === START :: Services === //
170+
153171
this.services.register('no-puter-yet', NoPuterYetService);
154172
this.services.register('filesystem', FilesystemService);
155173
this.services.register('api-access', APIAccessService);
@@ -182,6 +200,8 @@ window.puter = (function() {
182200
});
183201
})();
184202

203+
// === Start :: Modules === //
204+
185205
// The SDK is running in the Puter GUI (i.e. 'gui')
186206
if(this.env === 'gui'){
187207
this.authToken = window.auth_token;

0 commit comments

Comments
 (0)