Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » Are there any logging facilities?
Are there any logging facilities? [message #1740153] Tue, 09 August 2016 15:58 Go to next message
Eclipse UserFriend
Are there any logging facilities, maybe a robust as Python's logging?

If not, has anybody tried something similar like as follows?

Creating a wrapper service for DEBUG logs (printing to stdout).

Like so:
package project.services;

public class Logging {
	public void debug(String message) {
		System.out.println("DEBUG "+message);
	}
}


And adding to the template the usage as so:
[('Operation ' + i +': name=' + aParameter.name + ', direction=' + aParameter.direction + ', CRUD=' + aParameter.effect).debug() /]


I find it annoying to be getting an extra line feed on the generated files.
Using the following to still set debug print on separate line, but without the line feed overhead on the 'text'...

[('Operation ' + i +': name=' + aParameter.name + ', direction=' + aParameter.direction + ', CRUD=' + aParameter.effect).debug() /][ ''
/][next logics]


This is not pretty, but does the job.

Is there a pretty way, while keeping the debug calls on independent lines?

[Updated on: Sat, 13 August 2016 11:36] by Moderator

Re: Are there any logging facilities? [message #1740608 is a reply to message #1740153] Tue, 16 August 2016 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

You can use a file block with "stdout" as file name to print on the standard output, but we have no specific debug facilities other than that. You can use nested file blocks for that:

[file ('generatedFile.txt', false, 'UTF-8')]
generate this in file
  [file ('stdout', false, 'UTF-8')]
  this goes only in stdout
  [/file]
and this
[/file]


Laurent Goubet
Obeo
Re: Are there any logging facilities? [message #1742917 is a reply to message #1740608] Thu, 08 September 2016 11:05 Go to previous message
Eclipse UserFriend
I use these two functions:

The first to initialize the debug file, the second to output incrementally on that file. Also produce a blank line.

[template public initDebug(category:String)]
[file (category+'.log', false, 'UTF-8')]
[/file]
[/template]

[template public debug(string:String,category:String)]
[file (category+'.log', true, 'UTF-8')]
[string/]
[/file]
[/template]
Previous Topic:news.eclipse.org is shutting down.
Next Topic:tag []
Goto Forum:
  


Current Time: Wed Jul 09 04:56:47 EDT 2025

Powered by FUDForum. Page generated in 0.08124 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top