Skip to content

Commit

Permalink
feat(logs): log the svelte version on init
Browse files Browse the repository at this point in the history
  • Loading branch information
C0ZEN committed May 30, 2021
1 parent e5e0ee5 commit 43d361d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/components/svelte-version/svelte-version.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- As a module to only log once -->
<script context="module">
import { VERSION } from 'svelte/compiler';
import { LoggerService } from '../../features/logger/services/logger.service';
LoggerService.log(`Using Svelte ${VERSION}`);
</script>
17 changes: 17 additions & 0 deletions lib/features/logger/services/logger.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export class LoggerService {
public static log(message: Readonly<string>): LoggerService {
console.log(message);

return this;
}

public static debug(message: Readonly<string>): LoggerService {
console.debug(message);

return this;
}

public constructor() {
LoggerService.debug(`LoggerService created`);
}
}
4 changes: 4 additions & 0 deletions src/routes/__layout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<script>
import { base } from '$app/paths';
import SvelteVersion from '../../lib/components/svelte-version/svelte-version.svelte';
</script>

<!-- Log the svelte version -->
<SvelteVersion />

<!-- Common page to all routes -->
<h1>Achievements</h1>
<nav>
Expand Down
13 changes: 12 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,16 @@
"$lib/*": ["src/lib/*"]
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte", "scripts/*.js", "svelte.config.js"]
"include": [
"src/**/*.d.ts",
"src/**/*.js",
"src/**/*.ts",
"src/**/*.svelte",
"scripts/*.js",
"svelte.config.js",
"lib/**/*.d.ts",
"lib/**/*.js",
"lib/**/*.ts",
"lib/**/*.svelte"
]
}

0 comments on commit 43d361d

Please sign in to comment.