# Moai personal thread

**URL:** <https://discourse.stonehearth.net/t/moai-personal-thread/20070>\
**Category:** Scripting & Code\
**Created:** [February 13, 2016, 7:26pm UTC](https://discourse.stonehearth.net/t/moai-personal-thread/20070 "2016-02-13T19:26:27Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Moai](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/moai/32/16242_2.png) [@Moai](https://discourse.stonehearth.net/u/Moai)\
**Post date:** [June 25, 2016, 9:34pm UTC](https://discourse.stonehearth.net/t/moai-personal-thread/20070/16 "2016-06-25T21:34:02Z")

</div>

## Alpha 17: Writing to the console

There is an old topic by by Tom regarding how to write to the log:  
[http://discourse.stonehearth.net/t/how-to-log-from-your-mod/5222](http://discourse.stonehearth.net/t/how-to-log-from-your-mod/5222)

However, I could not get this method to work. There are instances of logs in the Lua code, the formula for which I replicated exactly in my own code. However, logging also requires another component: a modification of your `user_settings.json`. While the method described in Tom’s topic still works to open the console, no matter how much I tried, I couldn’t actually get it to display any logs. SO: If anyone here knows how to get the logging to work _right_, please reply to this post!

However, as I still have coding to do, I managed to kludge together a way to write to the log regardless. I did so by looking up some of the console text that it was printing out every time the game started, and copying the method from there. Here is the function I now use:

```
function log(text)
  radiant.log.write('my_mod_name', 0, text)
end

```

Use it like so:

`log("hello world")`

Don’t forget to add the console setting to your `user_settings.json`:

```
...
"logging": {
  "show_console": true
},
...

```

**Edit**  
Also, starting from now, I am no longer vivisecting Stonehearth. On one hand, doing so is faster, but it comes at a cost of risking your stuff being overwritten in an update. I’m still not making .smods, but at least I keep my stuff in a separate folder.

---

_[View the full topic](https://discourse.stonehearth.net/t/moai-personal-thread/20070)._
