Skip to content

Commit

Permalink
feat: add puter.log
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Nov 5, 2024
1 parent e71fe11 commit 755736e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/puter-js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ window.puter = (function() {
this.APIOrigin = 'https://api.' + URLParams.get('puter.domain');
}

// === START :: Logger ===

// logger will log to console
let logger = new putility.libs.log.ConsoleLogger();

// logs can be toggled based on categories
logger = new putility.libs.log.CategorizedToggleLogger(
{ delegate: logger });
const cat_logger = logger;

// create facade for easy logging
this.log = new putility.libs.log.LoggerFacade({
impl: logger,
cat: cat_logger,
});

// === START :: Services === //

this.services.register('no-puter-yet', NoPuterYetService);
this.services.register('filesystem', FilesystemService);
this.services.register('api-access', APIAccessService);
Expand Down Expand Up @@ -182,6 +200,8 @@ window.puter = (function() {
});
})();

// === Start :: Modules === //

// The SDK is running in the Puter GUI (i.e. 'gui')
if(this.env === 'gui'){
this.authToken = window.auth_token;
Expand Down

0 comments on commit 755736e

Please sign in to comment.