Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use logger for messaging #6

Open
1 of 11 tasks
sheljohn opened this issue Oct 30, 2018 · 0 comments
Open
1 of 11 tasks

Use logger for messaging #6

sheljohn opened this issue Oct 30, 2018 · 0 comments
Labels

Comments

@sheljohn
Copy link
Collaborator

sheljohn commented Oct 30, 2018

  • Remove +verb/ submodule, in favour of using the dk.logger.Logger implementation.
  • Default logger should be created at startup.
  • Additional function dk.logger.level to simplify level control.
  • Alias method Logger:setFile, more explicit than open.
  • Implement static class dk.logger.test to be called by assert/reject in order to redirect assertions to different channels.
  • Remove static method callerInfo from Logger, and move it to separate dk.logger.chan instead (taking stack depth argument), which returns a struct with channel ID and caller string.
  • Update Logger:write to take a channel as first input, and exclude empty caller from log line.
  • Implement function dk.log, taking a channel as first input (or creating a default one if formatted message is passed directly), with a persistent instance of the default logger.
funciton log(varargin)
    persistent..

    args = varargin;
    if nargin  > 1
        v = args{1};
        if isstruct(v)
            chan = v;
            args = varargin(2:end);
        elseif ismember(v,{'w','e','...'})
            chan = dk.logger.chan( v, 4 );
            args = varargin(2:end);
        else
            chan = dk.logger.chan( 'i', 4 );
        end
    end
    L.write( chan, args{:} );
end
  • Refactor functions dk.warn/info to call dk.log
  • Remove ..if methods from Logger, in favour of directed assertions.
  • Replace calls to dk.wassert/wreject with calls to assert with specified channels.
@sheljohn sheljohn added the change label Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant