From 7fd86bbdb7ed3b591aeb7969e7a649f07f16e917 Mon Sep 17 00:00:00 2001 From: Pat Kearns Date: Fri, 22 Sep 2023 10:29:14 +0800 Subject: [PATCH 1/9] Update log.md Source github URL currently brings me to the wrong place. Presumably these line numbers will change anytime someone commits to this file, so might need a better solution in the future to reference this code. --- website/docs/reference/dbt-jinja-functions/log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index ec4533ea621..db9479616e1 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -12,7 +12,7 @@ __Args__: Logs a line to either the log file or stdout. -([Source on GitHub](https://github.com/dbt-labs/dbt-core/blob/HEAD/core/dbt/context/base.py#L432)) +([Source on GitHub](https://github.com/dbt-labs/dbt-core/blob/HEAD/core/dbt/context/base.py#L549-L566)) ```sql From 226fb6f672667d3eef9e57285c3bf9d5ed0ab533 Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 15:31:20 +0100 Subject: [PATCH 2/9] Update log.md --- .../docs/reference/dbt-jinja-functions/log.md | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index db9479616e1..7ede46e55aa 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -12,7 +12,31 @@ __Args__: Logs a line to either the log file or stdout. -([Source on GitHub](https://github.com/dbt-labs/dbt-core/blob/HEAD/core/dbt/context/base.py#L549-L566)) +
+ Code source + Refer to GitHub or the following code as a source: + + def log(msg: str, info: bool = False) -> str: + """Logs a line to either the log file or stdout. + + :param msg: The message to log + :param info: If `False`, write to the log file. If `True`, write to + both the log file and stdout. + + > macros/my_log_macro.sql + + {% macro some_macro(arg1, arg2) %} + {{ log("Running some_macro: " ~ arg1 ~ ", " ~ arg2) }} + {% endmacro %}" + """ + if info: + fire_event(JinjaLogInfo(msg=msg, node_info=get_node_info())) + else: + fire_event(JinjaLogDebug(msg=msg, node_info=get_node_info())) + return "" + + +
```sql From e5d95b2c1f3a71ca41fcab94322be091c7c08b8e Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 15:46:26 +0100 Subject: [PATCH 3/9] Update log.md --- website/docs/reference/dbt-jinja-functions/log.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index 7ede46e55aa..fa083cd80fa 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -14,9 +14,9 @@ Logs a line to either the log file or stdout.
Code source - Refer to GitHub or the following code as a source: + Refer to GitHub or the following code as a source:
- def log(msg: str, info: bool = False) -> str: + def log(msg: str, info: bool = False) -> str: """Logs a line to either the log file or stdout. :param msg: The message to log @@ -34,8 +34,9 @@ Logs a line to either the log file or stdout. else: fire_event(JinjaLogDebug(msg=msg, node_info=get_node_info())) return "" - - + + +
```sql From cbee75b8c2f447032f29489d47af0462f8bca616 Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 15:53:15 +0100 Subject: [PATCH 4/9] Update log.md --- website/docs/reference/dbt-jinja-functions/log.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index fa083cd80fa..30525b703ce 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -16,6 +16,7 @@ Logs a line to either the log file or stdout. Code source Refer to GitHub or the following code as a source:
+ def log(msg: str, info: bool = False) -> str: """Logs a line to either the log file or stdout. @@ -35,7 +36,7 @@ Logs a line to either the log file or stdout. fire_event(JinjaLogDebug(msg=msg, node_info=get_node_info())) return "" - + From e3606be2709f33ed747b400b0ea92dd127416650 Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:00:13 +0100 Subject: [PATCH 5/9] Update website/docs/reference/dbt-jinja-functions/log.md --- website/docs/reference/dbt-jinja-functions/log.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index 30525b703ce..572d488d7a7 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -18,6 +18,7 @@ Logs a line to either the log file or stdout. def log(msg: str, info: bool = False) -> str: + """Logs a line to either the log file or stdout. :param msg: The message to log From 96b28641eb62f25b2c3b87fdac111bf6013b800c Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:00:32 +0100 Subject: [PATCH 6/9] Update website/docs/reference/dbt-jinja-functions/log.md --- website/docs/reference/dbt-jinja-functions/log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index 572d488d7a7..3986ce9907e 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -14,7 +14,7 @@ Logs a line to either the log file or stdout.
Code source - Refer to GitHub or the following code as a source:
+ Refer to GitHub or the following code as a source:

def log(msg: str, info: bool = False) -> str: From d567a05afb1a7c479444da67b604661aeb894523 Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 16:05:09 +0100 Subject: [PATCH 7/9] Update log.md --- website/docs/reference/dbt-jinja-functions/log.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index 3986ce9907e..49ae4e264aa 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -15,6 +15,7 @@ Logs a line to either the log file or stdout.
Code source Refer to GitHub or the following code as a source:

+ def log(msg: str, info: bool = False) -> str: From b21616d46bb80826ff55e401ae7a6cd23f734e2d Mon Sep 17 00:00:00 2001 From: mirnawong1 <89008547+mirnawong1@users.noreply.github.com> Date: Mon, 25 Sep 2023 17:00:55 +0100 Subject: [PATCH 8/9] Update log.md --- website/docs/reference/dbt-jinja-functions/log.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index 49ae4e264aa..b13af9ac286 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -16,9 +16,9 @@ Logs a line to either the log file or stdout. Code source Refer to GitHub or the following code as a source:

- + - def log(msg: str, info: bool = False) -> str: + def log(msg: str, info: bool = False) -> str:
"""Logs a line to either the log file or stdout. From aed958302229fc8589b709d0eae6e7a07711fecb Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Tue, 26 Sep 2023 10:18:11 +0100 Subject: [PATCH 9/9] add code per pat's sugg --- website/docs/reference/dbt-jinja-functions/log.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/website/docs/reference/dbt-jinja-functions/log.md b/website/docs/reference/dbt-jinja-functions/log.md index b13af9ac286..30e68f8c21d 100644 --- a/website/docs/reference/dbt-jinja-functions/log.md +++ b/website/docs/reference/dbt-jinja-functions/log.md @@ -15,11 +15,9 @@ Logs a line to either the log file or stdout.
Code source Refer to GitHub or the following code as a source:

- - - - def log(msg: str, info: bool = False) -> str:
- + +```python + def log(msg: str, info: bool = False) -> str: """Logs a line to either the log file or stdout. :param msg: The message to log @@ -37,8 +35,9 @@ Logs a line to either the log file or stdout. else: fire_event(JinjaLogDebug(msg=msg, node_info=get_node_info())) return "" - -
+``` + +