Skip to content

Commit

Permalink
feat: Remove storage logging and add reset logging (#1342)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-c authored Aug 5, 2024
1 parent db4d887 commit 017d765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@ export class PostHog {
* Useful for clearing data when a user logs out.
*/
reset(reset_device_id?: boolean): void {
logger.info('reset')
if (!this.__loaded) {
return logger.uninitializedWarning('posthog.reset')
}
Expand Down
16 changes: 3 additions & 13 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const cookieStore: PersistentStore = {
return cookie
},

set: function (name, value, days, cross_subdomain, is_secure, debug) {
set: function (name, value, days, cross_subdomain, is_secure) {
if (!document) {
return
}
Expand Down Expand Up @@ -158,10 +158,6 @@ export const cookieStore: PersistentStore = {
logger.warn('cookieStore warning: large cookie, len=' + new_cookie_val.length)
}

if (debug) {
logger.info('cookie set', new_cookie_val)
}

document.cookie = new_cookie_val
return new_cookie_val
} catch (err) {
Expand Down Expand Up @@ -232,11 +228,8 @@ export const localStore: PersistentStore = {
return null
},

set: function (name, value, _days, _cross_subdomain, _secure, debug) {
set: function (name, value) {
try {
if (debug) {
logger.info('localStorage set', name, value)
}
window?.localStorage.setItem(name, JSON.stringify(value))
} catch (err) {
localStore.error(err)
Expand Down Expand Up @@ -383,11 +376,8 @@ export const sessionStore: PersistentStore = {
return null
},

set: function (name, value, _days, _cross_subdomain, _secure, debug) {
set: function (name, value) {
try {
if (debug) {
logger.info('sessionStorage set', name, value)
}
window?.sessionStorage.setItem(name, JSON.stringify(value))
} catch (err) {
sessionStore.error(err)
Expand Down

0 comments on commit 017d765

Please sign in to comment.