本文整理汇总了TypeScript中ng2-logger.Log.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Log.create方法的具体用法?TypeScript Log.create怎么用?TypeScript Log.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ng2-logger.Log
的用法示例。
在下文中一共展示了Log.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: hello
//#region @backend
console.log('heeloa')
import * as path from 'path';
import * as _ from "lodash";
import "reflect-metadata";
import { createConnection, useContainer } from 'typeorm';
//#endregion
import { init, ENDPOINT, GET, Response } from 'morphi';
import { Log, Level } from 'ng2-logger';
const log = Log.create('main application')
const log2 = Log.create('auth module')
const log3 = Log.create('books module')
const log4 = Log.create("/Users/test/Projects/testProject/index.ts")
export class User {
name: string;
id: number;
friend: User;
}
@ENDPOINT({ path: '/hello' })
export class UserController {
@GET('/')
hello(): Response<User> {
let user = new User();
return { send: user }
示例2: DebugLog
import { Log } from 'ng2-logger';
export const log = Log.create('<%= conf.appNameKC %>');
log.color = 'black';
export function DebugLog(target: Object, key: string, descriptor: TypedPropertyDescriptor<any>) {
return {
value: function(...args: any[]) {
const result = descriptor.value.apply(this, args);
log.data(`Call: ${target.constructor.name}.${key}`, { arguments: args });
return result;
}
};
}
示例3:
import * as _ from 'lodash';
import { describe } from 'mocha'
import { expect, use } from 'chai'
import { CLASS } from 'typescript-class-helpers';
// import { BrowserDB } from '../browser-db/browser-db';
import { Mapping } from '../mapping'
import { encode } from 'punycode';
import { Log } from 'ng2-logger';
const log = Log.create('mapping test')
// const instance = BrowserDB.instance;
describe('Mapping inheritance', () => {
// @CLASS.NAME('Coffee')
class Coffee {
}
// @CLASS.NAME('Project')
@Mapping.DefaultModelWithMapping<Project>(void 0, {
cup: 'Coffee',
projectInside: 'Project'
})
class Project {
cup: Coffee;
projectInside: Project;
location: string;
示例4: children
import * as _ from 'lodash';
import { describe } from 'mocha'
import { expect, use } from 'chai'
import { Log } from 'ng2-logger';
const log = Log.create('Circural test');
// import { BrowserDB } from '../browser-db/browser-db';
import { Mapping } from '../mapping'
import { CLASS } from 'typescript-class-helpers';
@CLASS.NAME('Project')
export class Project {
browser: {
name: string;
location: string;
children: Project[];
parent: Project;
}
get children() {
return this.browser && this.browser.children;
}
get parent() {
return this.browser && this.browser.parent;
}