Skip to content

Commit

Permalink
Adds better logging support
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 13, 2018
1 parent 0ee7e5e commit a78456e
Show file tree
Hide file tree
Showing 9 changed files with 549 additions and 509 deletions.
16 changes: 14 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Commands, registerCommands } from './commands';
import { Config, configuration, Configuration } from './configuration';
import { CommandContext, extensionQualifiedId, GlobalState, GlyphChars, setCommandContext } from './constants';
import { Container } from './container';
import { GitService } from './git/gitService';
import { GitCommit, GitService, GitUri } from './git/gitService';
import { Logger } from './logger';
import { Messages } from './messages';
import { Strings, Versions } from './system';
Expand All @@ -17,7 +17,19 @@ export async function activate(context: ExtensionContext) {
// Pretend we are enabled (until we know otherwise) and set the view contexts to reduce flashing on load
setCommandContext(CommandContext.Enabled, true);

Logger.configure(context);
Logger.configure(context, o => {
if (o instanceof GitUri) {
return `GitUri(${o.toString(true)}${o.repoPath ? ` repoPath=${o.repoPath}` : ''}${
o.sha ? ` sha=${o.sha}` : ''
})`;
}

if (o instanceof GitCommit) {
return `GitCommit(${o.sha ? ` sha=${o.sha}` : ''}${o.repoPath ? ` repoPath=${o.repoPath}` : ''})`;
}

return undefined;
});

const gitlens = extensions.getExtension(extensionQualifiedId)!;
const gitlensVersion = gitlens.packageJSON.version;
Expand Down

0 comments on commit a78456e

Please sign in to comment.