Show / Hide Table of Contents

    Logging

    By adding the Crosser logging interface ILog to your modules constructor as a parameter you can hook into the logger of the EdgeNode.

    Example with ILog in constructor and usage in MessageReceived

    public class RandomNumberModule : FlowModule<RandomNumberModuleSettings>
    {
        // Code removed for readability
        private ILog logger;
    
        public RandomNumberModule(ILog log) : base(FlowModuleType.Function)
        {
            this.logger = log;
        }
    
        protected override async Task MessageReceived(IFlowMessage msg)
        {
            this.logger.Debug("RandomNumberModule.MessageReceived: {@msg}", msg);
            // Code removed for readability
        }
    }
    

    See the ILog interface for a full list of methods

    Warning

    Be careful with what level you log at. You do not want to log Verbose data into higher levels such as Information.

    Back to top Crosser SDK