Is there a way to log to the Caspar server analogous to console.log()

Hi,

I’m new to Caspar and wondering if there is a Caspar specific function I can put in my main JS file that will print to the server terminal when I play the animation through the Caspar client. Basically, I need a way to debug my code. Console.log() doesn’t work.

I know this is super basic, but I haven’t been able to find it.

console.warn works in older versions I believe

versions with updated cef producer (nrk fork and 2.2) have support for console.log

i red this yesterday and i thought that i had done this.
but i cant find it.

for testing you could just add a div that you can append with messages.
or you could use the alert. that works

Taking this one step further. Can you send these logs over TCP? Can it be set via the Log Level? I see that come up as [info].

NRK fork has LOG over tcp (https://github.com/nrkno/tv-automation-casparcg-server/blob/2.1.x/shell/casparcg.config#L32) It was first introduced in the offical CCG around 2.1 and then removed for 2.2.

Thank you! Do you know if this feature will be added back in for 2.3? Or why it was removed?

I’m not sure. You can see it was removed along with various other items for 2.2.0: https://github.com/CasparCG/server/blob/36e2ba34a02e7a689cbc65151440bd9d8fad07d9/CHANGELOG.md

However Robert Nagy has opened an issue that makes it a milestone for 2.3/3.0 so it might be come back: https://github.com/CasparCG/server/issues/778

I see, hopefully this gets added soon-ish along with the INFO commands since it would make building custom HTML clients much more reliable. Thank you again for the info!

Well you don’t need INFO for that (I haven’t use INFO for many years) - but rather the OSC protocol.

This is where my knowledge ends, sorry. Currently I’m using TCP to send AMCP commands to a NodeJS server that is using CasparCG-Connection to handle the logs. My config file looks like this.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<paths>
		<!-- Setup Media Paths -->
	</paths>
	<log-level>debug</log-level>
	<channels>
		<channel>
			<!-- Setting up Consumers -->
		</channel>
	</channels>

	<controllers>
		<tcp>
			<port>5250</port>
			<protocol>AMCP</protocol>
		</tcp>
	</controllers>
        <!-- Pretty sure I don't need this next part?-->
	<amcp>
		<media-server>
			<host>192.168.1.2</host>
			<port>8080</port>
		</media-server>
	</amcp>
</configuration>

Should I be using OSC like it is described here? Would that send me the same thing as INFO CONFIG used to? Also, would it send the same things as the TCP Controller is now?

It would be very easy to write a replacement for the TCP LOG as a standalone node app (or any language really)

What do you mean by a replacement? Switching out the the TCP for OSC?

We’ll I’d like to keep it in CCG. I already have it implemented so it’s available to HTML templates.

You want:

<osc>
  <default-port>6250</default-port>
  <disable-send-to-amcp-clients>false</disable-send-to-amcp-clients>
  <predefined-clients>
    <predefined-client>
      <address>127.0.0.1</address>
      <port>5253</port>
    </predefined-client>
  </predefined-clients>
</osc>

I think it should actually be running if your are connected with casparcg-connecection (even w/o the config options).

I agree, I meant to suggest that as a workaround

1 Like

I mean that as 2.2 does not have the TCP LOG functionality, then until it comes back you could do it externally

I updated my config file and the server is crashing. The file did pass the Online Validator

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<paths>
		<!-- Paths -->
	</paths>
	<lock-clear-phrase>ilec</lock-clear-phrase>
	<log-level>info</log-level>
	<channels>
		<channel>
			<!-- Consumers -->
		</channel>
	</channels>

	<controllers>
		<osc>
                    <default-port>6250</default-port>
                    <disable-send-to-amcp-clients>false</disable-send-to-amcp-clients>
                    <predefined-clients>
                       <predefined-client>
                          <address>127.0.0.1</address>
                          <port>5253</port>
                      </predefined-client>
                 </predefined-clients>
             </osc>
	</controllers>
</configuration>

Gotcha, that makes sense. Where could I find info on how to implement this work around? Getting Logs from the HTML files to CasparCG-Connection would be huge!

OSC shouldn’t be in controllers - but on it’s own like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<paths>
		<!-- Paths -->
	</paths>
	<lock-clear-phrase>ilec</lock-clear-phrase>
	<log-level>info</log-level>
	<channels>
		<channel>
			<!-- Consumers -->
		</channel>
	</channels>

	<controllers>
		<tcp>
			<port>5250</port>
			<protocol>AMCP</protocol>
		</tcp>
	</controllers>
		<osc>
                    <default-port>6250</default-port>
                    <disable-send-to-amcp-clients>false</disable-send-to-amcp-clients>
                    <predefined-clients>
                       <predefined-client>
                          <address>127.0.0.1</address>
                          <port>5253</port>
                      </predefined-client>
                 </predefined-clients>
             </osc>
</configuration>

TCP logs are simple sockets so you could just use telnet in node to get the data…

Regarding messaging from HTML templates to clients that is something that is smarter to do with OSC. I have it partly finished but no PR yet.