Sweet.apex

  • Docs
  • Tutorials
Docs Menu
  • Sweet.apex Core
    • Transpilation
    • Grammar
    • Command
    • Config
  • Features
    • Action
    • Apex Doc
    • Array Creation
    • Aspect
    • Cast
    • Default Value
    • Enum
    • File
    • Function
    • Identity
    • Injection
    • Lambda
    • Log
    • Mod
    • Not Null
    • Operator
    • Optional
    • Reflection
    • Rethrow
    • Switch
    • Template String
    • Template
    • Script
    • Tagged String
    • Annotation
    • Nullable
    • Var
    • Val
    • Map Access
    • Constructor
    • Transaction
    • Destructure
    • Import Static
    • Pipeline
    • Varargs
    • Patch
    • Import As
  • Plugin Development
    • Feature
    • Test Case

Log Guide

Log

Feature Overview

This feature generates the logger object for the class.

Prerequisite

You need to include Log.apex if you want to enable this feature.

Sweet Apex Example

@log
public class LogDemo {
    public static void main() {
        System.debug('Logging');
    }
}

Transpiled Apex

public class LogDemo {
    public static final Log logger = Log.getLogger(LogDemo.class);

    public static void main() {
        System.debug('Logging');
    }
}

Usage

@log can only be applied to top level classes, as static variables can only be declared in top level classes.

Contribute on Github! Edit this section.