Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Are there any logging facilities?
Are there any logging facilities? [message #1740153] Tue, 09 August 2016 19:58 Go to next message
Shimon Zadok is currently offline Shimon ZadokFriend
Messages: 24
Registered: May 2016
Junior Member
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 15:36]

Report message to a moderator

Re: Are there any logging facilities? [message #1740608 is a reply to message #1740153] Tue, 16 August 2016 08:07 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
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 15:05 Go to previous message
pere joseph rodríguez is currently offline pere joseph rodríguezFriend
Messages: 47
Registered: October 2014
Member
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: Fri Mar 29 08:57:23 GMT 2024

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

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

Back to the top