當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Log.create方法代碼示例

本文整理匯總了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 }
開發者ID:darekf77,項目名稱:ng2-logger,代碼行數:31,代碼來源:index.ts

示例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;
    }
  };
}
開發者ID:garlictech,項目名稱:generator-garlic-webapp,代碼行數:14,代碼來源:log.ts

示例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;
開發者ID:darekf77,項目名稱:ng2-rest,代碼行數:30,代碼來源:mapping-inheritance.spec.ts

示例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;
  }
開發者ID:darekf77,項目名稱:ng2-rest,代碼行數:29,代碼來源:circural.spec.ts


注:本文中的ng2-logger.Log.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。