Appearance
Logging
Send messages to GemShell's build log.
Methods
log(message, ...args)
Log an info message:
javascript
gemshell.log('Processing assets...');
gemshell.log('Found', 42, 'files');warn(message, ...args)
Log a warning:
javascript
gemshell.warn('File not found, using default');error(message, ...args)
Log an error:
javascript
gemshell.error('Failed to process image:', filename);Output
Messages appear in GemShell's build log panel:
[MyPlugin] Processing assets...
[MyPlugin] Found 42 files
[MyPlugin] WARNING: File not found, using default
[MyPlugin] ERROR: Failed to process image: sprite.pngExample
javascript
module.exports = {
name: 'Build Stats',
version: '1.0.0',
async onPreBuild(context, settings) {
gemshell.log('Build starting...');
gemshell.log('Game:', context.config.title);
gemshell.log('Platform:', context.platform);
},
async onModifyAssets(context, settings) {
const files = gemshell.glob('**/*');
gemshell.log(`Processing ${files.length} files`);
if (files.length > 1000) {
gemshell.warn('Large number of files may slow build');
}
},
async onPostBuild(context, settings) {
gemshell.log('Build complete!');
},
async onBuildError(context, settings) {
gemshell.error('Build failed:', context.error);
}
};