Skip to content

Commit

Permalink
[cb-#99] working on logging
Browse files Browse the repository at this point in the history
  • Loading branch information
crookse committed Dec 27, 2019
1 parent 4047ba5 commit a1692b2
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 146 deletions.
@@ -0,0 +1,54 @@
<template lang="pug">
page-tutorial(
:toc="toc"
)
div.row
div.col
hr
h2-hash Before You Get Started
ul
list-item-download-source-code(:source_code_uri="$route.meta.source_code_uri")
div.row
div.col
hr
h2-hash Steps
ol
li Create your app file.
code-block(:data="example_code.app")
li Run your app.
code-block(:data="example_code.run")
li Check the terminal you used to start <code>app.ts</code>. The log messages in <code>HomeResource</code> will be written in the terminal. The other log messages come from the <code>Drash.Http.Server</code> class.
code-block-slotted
template(v-slot:title) /path/to/your/project/server.log
template(v-slot:code)
| 2019-04-20 02:54:13.467Z | INFO | Request received: GET /
| 2019-04-20 02:54:13.468Z | DEBUG | Calling HomeResource.GET() method.
| 2019-04-20 02:54:13.468Z | FATAL | This is a FATAL log message.
| 2019-04-20 02:54:13.468Z | ERROR | This is an ERROR log message
| 2019-04-20 02:54:13.468Z | WARN | This is a WARN log message
| 2019-04-20 02:54:13.468Z | INFO | This is an INFO log message
| 2019-04-20 02:54:13.468Z | DEBUG | This is a DEBUG log message
| 2019-04-20 02:54:13.468Z | TRACE | This is a TRACE log message
| 2019-04-20 02:54:13.468Z | INFO | Sending response. Content-Type: application/json. Status: 200 (OK).
| 2019-04-20 02:54:13.485Z | DEBUG | /favicon.ico requested.
| 2019-04-20 02:54:13.485Z | DEBUG | All future log messages for /favicon.ico will be muted.
</template>

<script>
export const resource = {
paths: ["/tutorials/logging/logging-to-files"],
meta: {
title: "Logging: Logging To Files",
tutorial_title: "Logging To Files",
source_code_uri: "/tutorials/logging/logging_to_files"
}
}
export default {
data() {
return {
example_code: this.$app_data.example_code['/docs/src/example_code/tutorials/logging_to_files']
};
},
}
</script>
@@ -0,0 +1,60 @@
<template lang="pug">
page-tutorial(
:toc="toc"
)
div.row
div.col
hr
h2-hash Before You Get Started
list-item-download-source-code(:source_code_uri="$route.meta.source_code_uri")
div.row
div.col
hr
h2-hash Steps
ol
li Create your app file.
code-block(:data="example_code.app")
li Run your app.
code-block(:data="example_code.run")
li Check the terminal you used to start <code>app.ts</code>. The log messages in <code>HomeResource</code> will be written in the terminal. The other log messages come from the <code>Drash.Http.Server</code> class.
code-block-slotted
template(v-slot:title) Terminal
template(v-slot:code)
| 2019-04-20 02:54:13.467Z | INFO | Request received: GET /
| 2019-04-20 02:54:13.468Z | DEBUG | Calling HomeResource.GET() method.
| 2019-04-20 02:54:13.468Z | FATAL | This is a FATAL log message.
| 2019-04-20 02:54:13.468Z | ERROR | This is an ERROR log message
| 2019-04-20 02:54:13.468Z | WARN | This is a WARN log message
| 2019-04-20 02:54:13.468Z | INFO | This is an INFO log message
| 2019-04-20 02:54:13.468Z | DEBUG | This is a DEBUG log message
| 2019-04-20 02:54:13.468Z | TRACE | This is a TRACE log message
| 2019-04-20 02:54:13.468Z | INFO | Sending response. Content-Type: application/json. Status: 200 (OK).
| 2019-04-20 02:54:13.485Z | DEBUG | /favicon.ico requested.
| 2019-04-20 02:54:13.485Z | DEBUG | All future log messages for /favicon.ico will be muted.
</template>

<script>
export const resource = {
paths: ["/tutorials/logging/logging-to-the-terminal"],
meta: {
title: "Logging: Logging To The Terminal",
tutorial_title: "Logging To The Terminal",
source_code_uri: "/tutorials/logging/logging_to_the_terminal"
},
toc: {
items: [
"Before You Get Started",
"Steps",
"Verification",
]
}
}
export default {
data() {
return {
example_code: this.$app_data.example_code['/docs/src/example_code/tutorials/logging/logging_to_the_terminal']
};
},
}
</script>
@@ -0,0 +1,59 @@
<template lang="pug">
page-tutorial-default
div.row
div.col
hr
h2#before-you-get-started Before You Get Started
ul
li <a href="https://github.com/denoland/deno_std" target="_BLANK">deno_std</a> has a <a href="https://github.com/denoland/deno_std/tree/master/log" target="_BLANK">Log</a> module that is readily available and you can use it as your logger of choice.
li Drash uses deno_std v{{ $conf.deno_std_version }}.
list-item-download-source-code(:source_code_uri="$route.meta.source_code_uri")
div.row
div.col
hr
h2#steps Steps
ol
li Create your app file.
code-block(:data="example_code.app")
div.row
div.col
hr
ul
li Run your app.
code-block(:data="example_code.run")
li Enter the following URL in your browser:
code-block-slotted(:header="false")
template(#code)
| localhost:1337
li Check the terminal you started your app with and you should see the following output:
code-block-slotted
template(#title) Terminal
template(#code)
| Deno server started at localhost:1337.
|
| INFO Setting a response.
</template>

<script>
export const resource = {
paths: ["/tutorials/logging/logging-using-log-from-deno-std"],
meta: {
title: "Logging Using Log From deno_std",
source_code_uri: "/tutorials/logging/logging_using_log_from_deno_std"
}
}
export default {
data() {
return {
example_code: this.$app_data.example_code['/docs/src/example_code/tutorials/logging/logging_using_log_from_deno_std'],
toc: {
items: [
"Before You Get Started",
"Steps",
]
}
};
},
}
</script>
10 changes: 5 additions & 5 deletions docs/src/vue/components/pages/tutorials/logging_to_files.vue
Expand Up @@ -3,9 +3,9 @@ page-tutorial-logging(:data="data")
template(v-slot:steps)
ol
li Create your app file.
code-block(:data="data.example_code.app")
code-block(:data="example_code.app")
li Run your app.
code-block(:data="data.example_code.run")
code-block(:data="example_code.run")
li Check the terminal you used to start <code>app.ts</code>. The log messages in <code>HomeResource</code> will be written in the terminal. The other log messages come from the <code>Drash.Http.Server</code> class.
code-block-slotted
template(v-slot:title) /path/to/your/project/server.log
Expand Down Expand Up @@ -55,19 +55,19 @@ page-tutorial-logging(:data="data")

<script>
export const resource = {
paths: ["/tutorials/logging-to-files"],
paths: ["/tutorials/logging/logging-to-files"],
meta: {
title: "Logging: Logging To Files",
tutorial_title: "Logging To Files",
source_code_uri: "/tutorials/logging_to_files"
source_code_uri: "/tutorials/logging/logging_to_files"
}
}
export default {
data() {
return {
data: {
example_code: this.$app_data.example_code['/docs/src/example_code/tutorials/logging_to_files']
example_code: this.$app_data.example_code['/docs/src/example_code/tutorials/logging/logging_to_files']
}
};
},
Expand Down

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions docs/src/vue/components/sidebar.vue
Expand Up @@ -42,9 +42,9 @@ div.c-sidebar
a(:href="$conf.base_url + '/#/tutorials/middleware/adding-resource-level-middleware'") Adding Resource-Level Middleware
a Logging
div.l-submenu-1
a(:href="$conf.base_url + '/#/tutorials/logging-to-the-terminal'") Logging To The Terminal
a(:href="$conf.base_url + '/#/tutorials/logging-to-files'") Logging To Files
router-link(href="/tutorials/logging-using-log-from-deno-std") Logging Using Log From deno_std
a(:href="$conf.base_url + '/#/tutorials/logging/logging-to-the-terminal'") Logging To The Terminal
a(:href="$conf.base_url + '/#/tutorials/logging/logging-to-files'") Logging To Files
router-link(href="/tutorials/logging/logging-using-log-from-deno-std") Logging Using Log From deno_std
a Misc
div.l-submenu-1
a(:href="$conf.base_url + '/#/tutorials/adding-global-members'") Adding Global Members
Expand Down

0 comments on commit a1692b2

Please sign in to comment.