@viplance/nestjs-logger 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,8 +29,7 @@
29
29
  });
30
30
  ```
31
31
 
32
- Connect the database to store logs.
33
-
32
+ Connect the database to store logs.<br />
34
33
  ```typescript
35
34
  await LogModule.init(app, {
36
35
  ...,
@@ -51,7 +50,7 @@ Connect the database to store logs.
51
50
 
52
51
  this.logService.log('Some log information');
53
52
  ```
54
-
53
+ <br />
55
54
 
56
55
  ### Additional information
57
56
 
@@ -59,7 +58,7 @@ Connect the database to store logs.
59
58
  - The logs could be available at `your_application_url`/`path`?key=`key`
60
59
  - The log API could be available at `your_application_url`/`path`/api?key=`key`
61
60
  - By default the logs will be stored in memory and deleted when the application stops.<br />
62
-
61
+ <br />
63
62
 
64
63
  ### The LogService methods:
65
64
  - log()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viplance/nestjs-logger",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "NestJS internal logging system",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/public/index.html CHANGED
@@ -26,24 +26,32 @@
26
26
  </head>
27
27
  <body>
28
28
  <header>
29
- <div class="content container">
30
- <div class="logo">
31
- <img src="favicon.ico" alt="Logger" />
32
- <h2>NestJS logging system</h2>
33
- </div>
34
- <nav>
35
- <ul>
36
- <li class="all active" data-selector="all">All</a></li>
37
- <li class="log" data-selector="log">Log</a></li>
38
- <li class="error" data-selector="error">Error</li>
39
- <li class="warn" data-selector="warn">Warning</li>
40
- <li class="debug" data-selector="debug">Debug</li>
41
- <li class="verbose" data-selector="verbose">Verbose</li>
42
- </ul>
43
- </nav>
44
- <div onclick="getLogs()"><button class="white">Refresh</button></div>
29
+ <div class="container controls content">
30
+ <div class="logo">
31
+ <img src="favicon.ico" alt="Logger" />
32
+ <h2>NestJS logging system</h2>
33
+ </div>
34
+ <nav>
35
+ <ul>
36
+ <li class="all active" data-selector="all">All</a></li>
37
+ <li class="log" data-selector="log">Log</a></li>
38
+ <li class="error" data-selector="error">Error</li>
39
+ <li class="warn" data-selector="warn">Warning</li>
40
+ <li class="debug" data-selector="debug">Debug</li>
41
+ <li class="verbose" data-selector="verbose">Verbose</li>
42
+ </ul>
43
+ </nav>
44
+ <div onclick="getLogs()"><button class="white">Refresh</button></div>
45
+ </div>
46
+ <div class="container table-header">
47
+ <div class="col">Type</div>
48
+ <div class="col">Info</div>
49
+ <div class="col">Trace</div>
50
+ <div class="col">Count</div>
45
51
  </div>
46
52
  </header>
53
+
54
+ <div id="no-logs" class="content container center"><h3>No logs</h3></div>
47
55
 
48
56
  <div class="container mt-3">
49
57
  <section id="logs"></section>
@@ -141,12 +141,17 @@ async function getLogs() {
141
141
  return selectedLogTypes["all"] || selectedLogTypes[log.type];
142
142
  });
143
143
 
144
- let html = `<div class="header">
145
- <div class="col">Type</div>
146
- <div class="col">Info</div>
147
- <div class="col">Trace</div>
148
- <div class="col">Count</div>
149
- </div>`;
144
+ if (logs.length === 0) {
145
+ document.getElementById("no-logs").style.display = "block";
146
+ document.querySelector(".table-header").style.display = "none";
147
+ document.querySelector("nav").style.display = "none";
148
+ } else {
149
+ document.getElementById("no-logs").style.display = "none";
150
+ document.querySelector(".table-header").style.display = "flex";
151
+ document.querySelector("nav").style.display = "flex";
152
+ }
153
+
154
+ let html = "";
150
155
 
151
156
  logs.forEach((log) => {
152
157
  html += getLogHtmlElement(log);
@@ -10,10 +10,6 @@ body {
10
10
  position: relative;
11
11
  }
12
12
 
13
- body:nth-child(2) {
14
- margin-top: 4rem;
15
- }
16
-
17
13
  h1 {
18
14
  font-size: 2.5rem;
19
15
  font-weight: 400;
@@ -62,10 +58,17 @@ h3 {
62
58
  }
63
59
  }
64
60
 
65
- .shadow {
66
- box-shadow: 0.5rem 0.5rem 1.5rem 0.2rem #ddd;
61
+ #logs {
62
+ margin-top: 4rem;
63
+ }
64
+
65
+ #no-logs {
66
+ display: none;
67
+ margin-top: 6rem;
68
+ text-align: center;
67
69
  }
68
70
 
71
+ /* buttons */
69
72
  button {
70
73
  display: flex;
71
74
  justify-content: space-between;
@@ -106,31 +109,41 @@ button.white {
106
109
 
107
110
  /* header */
108
111
  header {
109
- padding-top: 1rem;
110
- box-sizing: border-box;
111
112
  display: flex;
112
- flex-direction: row;
113
- justify-content: center;
113
+ align-items: center;
114
+ box-sizing: border-box;
115
+ flex-direction: column;
114
116
  position: fixed !important;
115
117
  top: 0;
116
118
  background: var(--white);
119
+ padding-top: 1rem;
117
120
  z-index: 1;
118
121
  width: 100%;
119
122
  }
120
123
 
121
- header .logo {
124
+ .controls {
125
+ display: flex;
126
+ justify-content: space-between;
127
+ flex-direction: row;
128
+ }
129
+
130
+ .controls .logo {
122
131
  display: flex;
123
132
  align-items: center;
124
133
  justify-items: left;
125
134
  opacity: 0.8;
126
135
  }
127
136
 
128
- header .logo img {
137
+ .controls .logo img {
129
138
  height: 3rem;
130
139
  width: 3rem;
131
140
  margin-right: 1rem;
132
141
  }
133
142
 
143
+ nav {
144
+ display: none;
145
+ }
146
+
134
147
  nav ul {
135
148
  display: flex;
136
149
  justify-content: space-evenly;
@@ -169,40 +182,43 @@ nav ul li:hover {
169
182
  }
170
183
 
171
184
  /* table */
172
- .header,
185
+ .table-header,
173
186
  .row {
174
187
  display: flex;
175
188
  gap: 1rem;
189
+ flex-direction: row;
176
190
  row-gap: 1rem;
177
191
  align-items: center;
178
192
  justify-content: space-around;
179
193
  }
180
194
 
181
- .header {
195
+ .table-header {
196
+ display: none;
182
197
  height: 2rem;
183
198
  background-color: var(--dark);
184
199
  color: var(--white);
200
+ margin-top: 0.5rem;
185
201
  }
186
202
 
187
- .header .col,
203
+ .table-header .col,
188
204
  .row > :last-child {
189
205
  text-align: center;
190
206
  }
191
-
192
- .header > :first-child,
207
+ .table-header > :first-child,
193
208
  .row > :first-child {
194
209
  flex: 0 0 5rem;
195
210
  text-align: center;
196
211
  }
197
- .header > :nth-child(2),
212
+
213
+ .table-header > :nth-child(2),
198
214
  .row > :nth-child(2) {
199
215
  flex: 0 0 20rem;
200
216
  }
201
- .header > :nth-child(3),
217
+ .table-header > :nth-child(3),
202
218
  .row > :nth-child(3) {
203
219
  flex: 1 1 auto;
204
220
  }
205
- div.header > :last-child,
221
+ .table-header > :last-child,
206
222
  .row > :last-child {
207
223
  flex: 0 0 5rem;
208
224
  }