# Log is seen as an Error

**URL:** <https://discourse.nodered.org/t/log-is-seen-as-an-error/29107>\
**Category:** General\
**Created:** [28 June 2020 10:16 UTC](https://discourse.nodered.org/t/log-is-seen-as-an-error/29107 "2020-06-28T10:16:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolae.zidaru](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nicolae.zidaru](https://discourse.nodered.org/u/nicolae.zidaru)\
**Post date:** [28 June 2020 10:16 UTC](https://discourse.nodered.org/t/log-is-seen-as-an-error/29107/1 "2020-06-28T10:16:35Z")

</div>

Hello ,  
I have this code and Error and I need to make this proiect done by today.  
I have a Temp sensor on arduino how is connect with raspberry pi 4 and node red

Thx

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/7/d73bedd258b8ca8ce24400e05d47a766e648f2dc.jpeg)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 June 2020 10:19 UTC](https://discourse.nodered.org/t/log-is-seen-as-an-error/29107/2 "2020-06-28T10:19:17Z")

</div>

`log` is not a built-in function.

As it looks like you are trying to do a logarithm, then you want to use `Math.log()` - [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Math/log](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log)

---

<div class="post-metadata">

**Author:** ![nicolae.zidaru](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@nicolae.zidaru](https://discourse.nodered.org/u/nicolae.zidaru)\
**Post date:** [28 June 2020 11:13 UTC](https://discourse.nodered.org/t/log-is-seen-as-an-error/29107/3 "2020-06-28T11:13:06Z")

</div>

Hi ,

When I do that the console says “function tried to send a message of type number “

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 June 2020 11:19 UTC](https://discourse.nodered.org/t/log-is-seen-as-an-error/29107/4 "2020-06-28T11:19:43Z")

</div>

That is because you are returning just a Number and not a valid message object.

Instead of `return temp`, you should do:

```auto
msg.payload = temp;
return msg;

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 July 2020 11:19 UTC](https://discourse.nodered.org/t/log-is-seen-as-an-error/29107/5 "2020-07-12T11:19:53Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
