12-29-2022 04:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 04:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Is there a setting to increase the line length for the console.log?
The first instruction prints 106 characters to the log
The second instruction is ignored [nothing appears in the log]
console.log("123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456");
console.log("123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567");
Shown here in case anyone runs into this problem, of messages not appearing in the log.
Author | ch, passion for improvement.

12-29-2022 08:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-29-2022 08:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
It works for me (in Fitbit Studio)

12-29-2022 08:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 08:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks @kozm0naut , on a Sense in Fitbit Studio?
Author | ch, passion for improvement.

12-29-2022 09:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-29-2022 09:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
On a Versa 3 in Fitbit Studio

12-29-2022 10:05 - edited 12-29-2022 10:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 10:05 - edited 12-29-2022 10:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@kozm0naut- tested it again, it doesn't work, for Sense, Versa 3, App or Clock face, SDK 6.0 or 6,1
but works for Versa 2 SDK 4.3 App
Totally weird, there must be a parameter which controls line length.
Logged out of simulator 0.9.4 and back in and Studio on Firefox.
Author | ch, passion for improvement.

12-29-2022 11:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 11:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've experienced this often. I suspect that the dev bridge or comms connection gets flooded so it silently drops lines (especially long lines) to keep up.
I don't know of any way to change this behaviour. My only workaround is to output stuff less frequently or more briefly.
I think there's a third-party module that lets you log to a file/server for later access.
Gondwana Software

12-29-2022 14:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-29-2022 14:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Perhaps you could craft a utility function that checks the string length and over a certain length, breaks it up as needed and spits them out on a timeout of 1ms or something.
12-29-2022 17:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 17:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@kozm0naut Wow, that's a good idea! I might have a go at that.
Gondwana Software

12-29-2022 21:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 21:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@Gondwana - it's not a timing issue as reversing the 2 instructions produces the same error, so it is a line length issue, in which it doesn't even attempt to display anything at all.
You would think it would just display the text it can rather than ignore the instruction completely.
Merely switching between Versa 3 and Versa 2 gets different results, it works in the latter.
Author | ch, passion for improvement.

12-29-2022 21:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 21:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I think it's both things. If you try to spit out more than about 30 lines in quick succession, you'll start to miss some lines.
Gondwana Software

12-29-2022 23:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-29-2022 23:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@Gondwana- it's definitely not a timing issue in this case as running one or other of the instructions works or doesn't, consistently.
It seems like a bug or corruption with Simulator 0.9.4
Tried on a different PC with the older Simulator 0.9.2 and it works correctly.
@kozm0naut- can you confirm which version of simulator you tried with, that works for you?
Author | ch, passion for improvement.

12-31-2022 00:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-31-2022 00:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm not using the simulator, I am using an actual Versa 3.

12-31-2022 06:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-31-2022 06:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks @kozm0naut - it would seem to confirm a bug with the Simulator.
Author | ch, passion for improvement.

12-31-2022 21:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


12-31-2022 21:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
This was a fun diversion for a Sunday afternoon.
index.js:
import './console-queue'
console.enqueue('This is a very long line of text that may not be displayed by console.log(), which seems to be limited to a maximum message length of 105 characters.')
for (let i=0; i<100; i++)
console.enqueue(`The next value in the sequence is ${i}`)
console-queue.js:
const LOG_PERIOD = 10 // ms between console.log() calls; change this as required
const MAX_LENGTH = 65 // maximum length of a string to be passed to console.log() (105 max); 65 avoids most ugly wrapping
const queue = [] // enqueued strings to log
let timer // setTimeout id
console.enqueue = message => { // adding members to a built-in object is probably a bit naughty
// This function makes no attempt to check for memory exhaustion.
// It may be possible to append to a file to allow for a longer log queue, but writing to a file may not be faster than writing to console.
// It's possible to get the minified line number of the enqueue() function call using: (new Error()).stack
// ...but since minified line numbers don't match source code, they're not particularly useful.
// Recommended workaround is to put an identifying tag string at the start of each message; eg, enqueue(`myFunc x=${x}`)
if (message.length <= MAX_LENGTH) { // whole message will fit in one line
queue.push(message)
} else { // message is too long for one line, so break it up
// enqueue first line:
queue.push(message.substring(0, MAX_LENGTH - 1) + '\\')
message = message.substring(MAX_LENGTH - 1)
// enqueue intermediate lines:
while (message.length > MAX_LENGTH - 3) { // last line can contain MAX_LENGTH-3 characters
queue.push(' \\' + message.substring(0, MAX_LENGTH - 4) + '\\') // starting and ending ellipsis strings total 4 chars
message = message.substring(MAX_LENGTH - 4)
}
// enqueue last line:
queue.push(' \\' + message)
}
if (timer === undefined) timer = setTimeout(processQueue, LOG_PERIOD)
}
function processQueue() {
console.log(queue.shift())
if (queue.length) // the queue still has stuff in it
timer = setTimeout(processQueue, LOG_PERIOD)
else
timer = undefined // so that console.enqueue() knows to restart it
}
If, in index.js, you replace the calls to console.enqueue with console.log, the long line will probably disappear and the incrementing lines will probably skip some values.
Seems to work on current sim (Versa 3); not tested on hardware or Studio.
Gondwana Software
01-03-2023 13:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-03-2023 13:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@Gondwana Very cool, I had been thinking a queue is probably the real best solution so the lines don't get out of order. Nice work!
01-03-2023 13:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-03-2023 13:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@kozm0nautThanks! 😁 Lines can still get out of order if mixing .log and .enqueue. I was tempted to try to replace .log with .enqueue, but thought that might have been going a bit far.
Gondwana Software

