Skip to content

Commit

Permalink
Ref/logging storage (#347)
Browse files Browse the repository at this point in the history
* remove local storage persistence with comment for future refactor

* fmt
  • Loading branch information
Bean authored Feb 8, 2024
1 parent 5b1ed6b commit 2bff77e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/html/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- (DO NOT EDIT!) (HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Tue, 06 Feb 2024 21:02:40 GMT -->
<!-- (DO NOT EDIT!) (HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Thu, 08 Feb 2024 14:41:27 GMT -->
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -62,7 +62,7 @@
</style>
</head>
<body>
(HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Tue, 06 Feb 2024 21:02:40 GMT
(HTML) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-html.mjs Thu, 08 Feb 2024 14:41:27 GMT

<!-- ==================== ALL EXPORTED VANILLA LIBRARIES ==================== -->
<script src="dist/packages/access-control-conditions-vanilla/access-control-conditions.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion apps/react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ pre {
`,
}}
/>
(REACT) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-react.mjs Tue, 06 Feb 2024 21:02:41 GMT
(REACT) THIS FILE IS AUTOMATICALLY GENERATED FROM tools/scripts/gen-react.mjs Thu, 08 Feb 2024 14:41:27 GMT
<div id="root"></div>
<pre><code id="result"></code></pre>
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/src/lib/constants/autogen_internal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Last Modified: 2024-02-06 21:00:54
// Last Modified: 2024-02-08 14:39:50
// This file is auto-generated by tools/scripts/gen-internal-dev.mjs
export const INTERNAL_DEV = [
'https://167.114.17.204:443',
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/src/lib/logger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('logger', () => {
});

it('should persist logs across categories', async () => {
const count = 1_000;
const count = 10_000;
for (let i = 0; i < count; i++) {
const logger = lm.get('' + i, 'foo6');
logger.setLevel(LogLevel.DEBUG);
Expand Down
7 changes: 6 additions & 1 deletion packages/logger/src/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ export class Logger {

private _addLog(log: Log) {
this._logs.push(log);
log.id && this._addToLocalStorage(log);

// TODO: currently we are not deleting old request id's which over time will fill local storage as the maximum storage size is 10mb
// we should be deleting keys from the front of the collection of `Object.keys(category)` such that the first keys entered are deleted when we reach a pre defined key threshold
// this implementation assumes that serialization / deserialization from `localStorage` keeps the same key ordering in each `category` object as we will asssume the array produced from `Object.keys` will always be the same ordering.
// which then allows us to start at the front of the array and do `delete` operation on each key we wish to delete from the object.
//log.id && this._addToLocalStorage(log);
}

private _addToLocalStorage(log: Log) {
Expand Down

0 comments on commit 2bff77e

Please sign in to comment.